当前位置: 首页>>代码示例>>C#>>正文


C# World.MyPlayer类代码示例

本文整理汇总了C#中Sandbox.Game.World.MyPlayer的典型用法代码示例。如果您正苦于以下问题:C# MyPlayer类的具体用法?C# MyPlayer怎么用?C# MyPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MyPlayer类属于Sandbox.Game.World命名空间,在下文中一共展示了MyPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateBot

 public IMyBot CreateBot(MyPlayer player, MyObjectBuilder_Bot botBuilder, MyBotDefinition botDefinition)
 {
     var output = new MySandboxBot(player, botDefinition);
     if (botBuilder != null)
         output.Init(botBuilder);
     return output;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:7,代码来源:MySandboxBotFactory.cs

示例2: Update

        public bool Update(MyPlayer player, MyEntity entity) //returns if lost
        {
            //MySessionComponentMission.Static.TryCreateFromDefault(Id);

            //if (IsLocal(player.Id))
            //    UpdateLocal(player.Id);

            if (!Sync.IsServer)
                return false;

            MyMissionTriggers mtrig;
            if (!MissionTriggers.TryGetValue(player.Id, out mtrig))
            {
                //Debug.Assert(false,"Bad ID for update in missionTriggers");
                mtrig = TryCreateFromDefault(player.Id, false);
            }
            mtrig.UpdateWin(player, entity);
            if (!mtrig.Won)
                mtrig.UpdateLose(player, entity);
            else
            {
                m_someoneWon = true;
                MyAnalyticsHelper.ReportTutorialEnd();
            }
            return mtrig.Lost;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:26,代码来源:MySessionComponentMissionTriggers.cs

示例3: PlayerLost

 public static void PlayerLost(MyPlayer.PlayerId id, int triggerIndex)
 {
     MySessionComponentMissionTriggers.Static.SetLost(id, triggerIndex);
     if (!Sync.MultiplayerActive || !MySession.Static.IsScenario)
         return;
     LostMsg msg = new LostMsg();
     msg.index = triggerIndex;
     msg.playerId = id;
     Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:10,代码来源:MySyncMissionTriggers.cs

示例4: SendControlPilotMsg

        public void SendControlPilotMsg(MyPlayer player)
        {
            var msg = new ControlPilotMsg();

            msg.EntityId = Entity.Entity.EntityId;

            msg.SteamId = player.Id.SteamId;
            msg.SerialId = player.Id.SerialId;

            MySession.Static.SyncLayer.SendMessageToAllAndSelf(ref msg);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:11,代码来源:MySyncCryoChamber.cs

示例5: Update

        /*public bool Update(MyFaction faction, MyCharacter me)
        {
            bool res = false;
            if (faction != null)
                res = Update(faction.FactionId, me);
            else
                res = Update(me.EntityId, me);

            return res;
        }*/
        /*public bool Update()
        {
            return false;
        }*/

        public bool Update(MyPlayer.PlayerId Id, MyCharacter me)
        {
            MyMissionTriggers mtrig;
            if (!MissionTriggers.TryGetValue(Id, out mtrig))
            {
                //Debug.Assert(false,"Bad ID for update in missionTriggers");
                return false;
            }
            mtrig.UpdateWin(me);

            mtrig.UpdateLose(me);//!!
            return false;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:28,代码来源:MySessionComponentMissionTriggers.cs

示例6: MySandboxBot

        public MySandboxBot(MyPlayer botPlayer, MyBotDefinition botDefinition)
        {
            m_definition = botDefinition as MyAgentDefinition;

            m_player = botPlayer;
            m_navigation = new MyBotNavigation();
            m_respawnRequestSent = false;
            m_actionCollection = null;
            m_botMemory = new MyBotMemory(this);

            m_player.Controller.ControlledEntityChanged += Controller_ControlledEntityChanged;

            m_navigation.ChangeEntity(m_player.Controller.ControlledEntity);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:14,代码来源:MySandboxBot.cs

示例7: MyHumanoidBot

        public MyHumanoidBot(MyPlayer player, MyBotDefinition botDefinition)
            : base(player, botDefinition)
        {
            Debug.Assert(botDefinition is MyHumanoidBotDefinition, "Provided bot definition is not of humanoid type");
            if (m_player.Controller.ControlledEntity is MyCharacter) // when loaded player already controls entity
            {
                var character = m_player.Controller.ControlledEntity as MyCharacter;
                if (character.CurrentWeapon == null && StartingWeaponId.SubtypeId != MyStringHash.NullOrEmpty)
                {
                    AddItems(character);
                }
            }

            Sandbox.Game.Gui.MyCestmirDebugInputComponent.PlacedAction += DebugGoto;
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:15,代码来源:MyHumanoidBot.cs

示例8: TryCreateFromDefault

        public void TryCreateFromDefault(MyPlayer.PlayerId newId, bool overwrite)
        {
            if (overwrite)
                MissionTriggers.Remove(newId);
            else
                if (MissionTriggers.ContainsKey(newId))
                    return;//already exists, thats ok for us
            MyMissionTriggers mtrig = new MyMissionTriggers();
            MissionTriggers.Add(newId, mtrig);

            MyMissionTriggers source;
            MissionTriggers.TryGetValue(new MyPlayer.PlayerId(0,0), out source);
            if (source == null)
                //older save which does not have defaults set
                return;
            mtrig.CopyTriggersFrom(source);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:17,代码来源:MySessionComponentMissionTriggers.cs

示例9: Update

        public bool Update(MyPlayer.PlayerId Id, MyEntity entity) //returns if lost
        {
            //MySessionComponentMission.Static.TryCreateFromDefault(Id);

            if (IsLocal(Id))
                UpdateLocal(Id);

            if (!Sync.IsServer)
                return false;

            MyMissionTriggers mtrig;
            if (!MissionTriggers.TryGetValue(Id, out mtrig))
            {
                //Debug.Assert(false,"Bad ID for update in missionTriggers");
                mtrig=TryCreateFromDefault(Id, false);
            }
            mtrig.UpdateWin(Id, entity);
            if (!mtrig.Won)
                mtrig.UpdateLose(Id, entity);
            else
                m_someoneWon = true;
            return mtrig.Lost;
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:23,代码来源:MySessionComponentMissionTriggers.cs

示例10: ResetPlayerIdentity

        public void ResetPlayerIdentity(MyPlayer player)
        {
            if (player.Identity != null)
            {
                if (MySession.Static.Settings.PermanentDeath.Value)
                {
                    if (!player.Identity.IsDead)
                        Sync.Players.KillPlayer(player);

                    var faction = MySession.Static.Factions.TryGetPlayerFaction(player.Identity.IdentityId);
                    if (faction != null)
                        MyFactionCollection.KickMember(faction.FactionId, player.Identity.IdentityId);

                    //Clear chat history
                    if (MySession.Static.ChatSystem != null)
                    {
                        MySession.Static.ChatSystem.ClearChatHistoryForPlayer(player.Identity);
                    }

                    var identity = Sync.Players.CreateNewIdentity(player.DisplayName);
                    player.Identity = identity;
                }
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:24,代码来源:MyRespawnComponentBase.cs

示例11: SetupCharacterDefault

 public abstract void SetupCharacterDefault(MyPlayer player, MyWorldGenerator.Args args);
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:1,代码来源:MyRespawnComponentBase.cs

示例12: CreateNewIdentity

 public abstract MyIdentity CreateNewIdentity(string identityName, MyPlayer.PlayerId playerId, string modelName);
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:1,代码来源:MyRespawnComponentBase.cs

示例13: SendNewGlobalMessage

 public void SendNewGlobalMessage(MyPlayer.PlayerId senderId, string text)
 {
     MyMultiplayer.RaiseEvent(this, x => x.OnGlobalMessageRequest, senderId.SteamId, text);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:4,代码来源:MyCharacter.cs

示例14: SetPlayer

 public void SetPlayer(MyPlayer player, bool update = true)
 {
     m_controlInfo.Value = player.Id;
     if (Sync.IsServer && update)
     {
         MyPlayerCollection.ChangePlayerCharacter(player, this, this);
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyCharacter.cs

示例15: CreateBot

 public IMyBot CreateBot(MyPlayer player, MyObjectBuilder_Bot botBuilder, MyBotDefinition botDefinition)
 {
     Debug.Assert(m_botDataByBehaviorType.ContainsKey(botDefinition.BehaviorType), "Undefined behavior type. Bot is not going to be created");
     if (!m_botDataByBehaviorType.ContainsKey(botDefinition.BehaviorType))
         return null;
     Debug.Assert(m_botTypeByDefinitionType.ContainsKey(botDefinition.TypeDefinitionId.TypeId), "Type not found. Bot is not going to be created!");
     if (!m_botTypeByDefinitionType.ContainsKey(botDefinition.TypeDefinitionId.TypeId))
         return null;
     var botData = m_botDataByBehaviorType[botDefinition.BehaviorType];
     var behaviorTypeData = m_botTypeByDefinitionType[botDefinition.TypeDefinitionId.TypeId];
     IMyBot output = CreateBot(behaviorTypeData.BotType, player, botDefinition);
     CreateActions(output, botData.BotActionsType);
     CreateLogic(output, botData.LogicType, botDefinition.BehaviorSubtype);
     if (botBuilder != null)
         output.Init(botBuilder);
     return output;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyBotFactoryBase.cs


注:本文中的Sandbox.Game.World.MyPlayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。