Ejemplo n.º 1
0
        private int SpawnNewBotInternal(MyAgentDefinition agentDefinition, Vector3D?spawnPosition = null, bool createdByPlayer = false)
        {
            var currentHighestBotID = MyAIComponent.GenerateBotId(m_lastSpawnedBot);
            var newBotId            = currentHighestBotID;

            EnsureIdentityUniqueness(newBotId);
            m_agentsToSpawn[newBotId] = new AgentSpawnData(agentDefinition, spawnPosition, createdByPlayer);
            m_lastSpawnedBot          = newBotId;

            Sync.Players.RequestNewPlayer(newBotId, MyDefinitionManager.Static.GetRandomCharacterName(), agentDefinition.BotModel);
            return(newBotId);
        }
Ejemplo n.º 2
0
        private int SpawnNewBotInternal(MyAgentDefinition agentDefinition, Vector3D?spawnPosition = null, bool createAlways = false)
        {
            var currentHighestBotID = MyAIComponent.GenerateBotId(m_lastSpawnedBot);
            var newBotId            = currentHighestBotID;

            EnsureIdentityUniqueness(newBotId);
            m_agentsToSpawn[newBotId] = new AgentSpawnData(agentDefinition, spawnPosition, createAlways);
            m_lastSpawnedBot          = newBotId;

            Sync.Players.RequestNewPlayer(newBotId, agentDefinition.DisplayNameText, agentDefinition.BotModel);
            return(newBotId);
        }
Ejemplo n.º 3
0
 protected override void UnloadData()
 {
     base.UnloadData();
     if (MyPerGameSettings.EnableAi)
     {
         Sync.Players.NewPlayerRequestSucceeded -= new Action <MyPlayer.PlayerId>(this.PlayerCreated);
         Sync.Players.LocalPlayerRemoved        -= new Action <int>(this.LocalPlayerRemoved);
         Sync.Players.LocalPlayerLoaded         -= new Action <int>(this.LocalPlayerLoaded);
         Sync.Players.NewPlayerRequestFailed    -= new Action <int>(this.Players_NewPlayerRequestFailed);
         if (Sync.IsServer)
         {
             Sync.Players.PlayerRequesting -= new PlayerRequestDelegate(this.Players_PlayerRequesting);
             Sync.Players.PlayerRemoved    -= new Action <MyPlayer.PlayerId>(this.Players_PlayerRemoved);
         }
         if (this.m_pathfinding != null)
         {
             this.m_pathfinding.UnloadData();
         }
         this.m_botCollection.UnloadData();
         this.m_botCollection = null;
         this.m_pathfinding   = null;
         if (MyFakes.ENABLE_BEHAVIOR_TREE_TOOL_COMMUNICATION)
         {
             MyMessageLoop.RemoveMessageHandler((uint)0x40a, new ActionRef <System.Windows.Forms.Message>(this.OnUploadNewTree));
             MyMessageLoop.RemoveMessageHandler((uint)0x40c, new ActionRef <System.Windows.Forms.Message>(this.OnBreakDebugging));
             MyMessageLoop.RemoveMessageHandler((uint)0x40b, new ActionRef <System.Windows.Forms.Message>(this.OnResumeDebugging));
         }
         if (MyToolbarComponent.CurrentToolbar != null)
         {
             MyToolbarComponent.CurrentToolbar.SelectedSlotChanged -= new Action <MyToolbar, MyToolbar.SlotArgs>(this.CurrentToolbar_SelectedSlotChanged);
             MyToolbarComponent.CurrentToolbar.SlotActivated       -= new Action <MyToolbar, MyToolbar.SlotArgs, bool>(this.CurrentToolbar_SlotActivated);
             MyToolbarComponent.CurrentToolbar.Unselected          -= new Action <MyToolbar>(this.CurrentToolbar_Unselected);
         }
     }
     Static = null;
 }
Ejemplo n.º 4
0
 public MyAIComponent()
 {
     Static = this;
     BotFactory = Activator.CreateInstance(MyPerGameSettings.BotFactoryType) as IMyBotFactory;
     Random = new MyRandom();
 }
 public MyAIComponent()
 {
     Static = this;
     BotFactory = Activator.CreateInstance(MyPerGameSettings.BotFactoryType) as MyBotFactoryBase;
 }
Ejemplo n.º 6
0
 public MyAIComponent()
 {
     Static = this;
     BotFactory = Activator.CreateInstance(MyPerGameSettings.BotFactoryType) as MyBotFactoryBase;
 }
Ejemplo n.º 7
0
 public MyAIComponent()
 {
     Static     = this;
     BotFactory = Activator.CreateInstance(MyPerGameSettings.BotFactoryType) as IMyBotFactory;
     Random     = new MyRandom();
 }
Ejemplo n.º 8
0
 public MyAIComponent()
 {
     Static = this;
     BotFactory = Activator.CreateInstance(MyPerGameSettings.BotFactoryType) as MyBotFactoryBase;
     Random = MyFakes.DEBUG_AVOID_RANDOM_AI ? new MyRandom(0): new MyRandom();
 }
Ejemplo n.º 9
0
 public MyAIComponent()
 {
     Static     = this;
     BotFactory = Activator.CreateInstance(MyPerGameSettings.BotFactoryType) as MyBotFactoryBase;
     Random     = MyFakes.DEBUG_AVOID_RANDOM_AI ? new MyRandom(0): new MyRandom();
 }