public LocationCharacter GetFromCharacterObject(CharacterObject characterObject, bool useCivilianEquipment) { var origin = new SimpleAgentOrigin(characterObject); var agentData = new AgentData(origin); var actionSetCode = ActionSetCode.HumanLordActionSet; return(new LocationCharacter(agentData, args => { }, string.Empty, false, LocationCharacter.CharacterRelations.Neutral, actionSetCode, useCivilianEquipment)); }
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 } }