protected virtual void CreatePlayer() { this.game.PlayerTroop = Game.Current.ObjectManager.GetObject <BasicCharacterObject>("main_hero"); WorldFrame formationSpawnFrame = this.Mission.GetFormationSpawnFrame(this.Mission.PlayerTeam.Side, this.game.PlayerTroop.DefaultFormationClass, false); Agent agent = this.Mission.SpawnAgent(new AgentBuildData(this.game.PlayerTroop).Team(this.Mission.PlayerTeam).InitialFrame(formationSpawnFrame.ToGroundMatrixFrame()).Controller(Agent.ControllerType.Player)); agent.WieldInitialWeapons(); this.Mission.MainAgent = agent; }
private void SpawnAgents() { GameEntity gameEntity = Mission.Current.Scene.FindEntityWithTag("attacker_infantry"); foreach (Hero hero in this._needSpawnHeros) { WorldFrame spawnPosition = WorldFrame.Invalid; spawnPosition = new WorldFrame(gameEntity.GetGlobalFrame().rotation, new WorldPosition(gameEntity.Scene, gameEntity.GetGlobalFrame().origin)); SimpleAgentOrigin agentOrigin = new SimpleAgentOrigin(hero.CharacterObject, -1, null, default(UniqueTroopDescriptor)); bool spawnWithHorse = true; Agent agent = Mission.Current.SpawnTroop(agentOrigin, true, false, spawnWithHorse, false, false, 0, 0, true, false, false, null, spawnPosition.ToGroundMatrixFrame()); agent.UpdateSpawnEquipmentAndRefreshVisuals(hero.CivilianEquipment); if (!agent.IsMainAgent) { SimulateAgent(agent); } // agent.SetGuardedAgent(Agent.Main); // Agent.Main } }