protected override void OnVisualize() { if (Input.GetKeyDown(KeyCode.M)) { for (int i = 0; i < Spawns.Length; i++) { SpawnInfo info = Spawns[i]; while (AgentController.InstanceManagers.Count <= info.ControllerIndex) { AgentController cont = AgentController.Create(); PlayerManager.AddController(cont); for (int j = 0; j < AgentController.InstanceManagers.Count; j++) { AgentController ac = AgentController.InstanceManagers[j]; if (ac != cont) { cont.SetAllegiance(ac, AllegianceType.Enemy); ac.SetAllegiance(cont, AllegianceType.Enemy); } } } AgentController controller = AgentController.InstanceManagers[info.ControllerIndex]; for (int j = 0; j < info.Count; j++) { LSAgent agent = controller.CreateAgent(info.AgentCode, info.Position); if (AutoCommand) { Selector.Add(agent); } } } } }
protected override void OnInitialize() { Instance = this; IAgentControllerDataProvider database; if (!LSDatabaseManager.TryGetDatabase <IAgentControllerDataProvider>(out database)) { Debug.LogError("IAgentControllerDataProvider unavailable."); } //TODO: Re-implement cammander system. Putting on hold for now. //Also think of other settings for AgentController to be set in database AgentControllerDataItem[] controllerItems = database.AgentControllerData; for (int i = 0; i < controllerItems.Length; i++) { var item = controllerItems[i]; var controller = AgentController.Create(item.DefaultAllegiance); if (item.PlayerManaged) { PlayerManager.AddController(controller); } if (string.IsNullOrEmpty(item.CommanderCode) == false) { controller.CreateCommander(item.CommanderCode); } CodeIDMap.Add(item.Name, controller.ControllerID); } }
protected override void OnGameStart() { for (int i = 0; i < Spawns.Length; i++) { SpawnInfo info = Spawns [i]; while (AgentController.InstanceManagers.Count <= info.ControllerIndex) { AgentController cont = AgentController.Create(); PlayerManager.AddController(cont); for (int j = 0; j < AgentController.InstanceManagers.Count; j++) { AgentController ac = AgentController.InstanceManagers [j]; if (ac != cont) { cont.SetAllegiance(ac, AllegianceType.Enemy); ac.SetAllegiance(cont, AllegianceType.Enemy); } } } AgentController controller = AgentController.InstanceManagers [info.ControllerIndex]; for (int j = 0; j < info.Count; j++) { LSAgent agent = controller.CreateAgent(info.AgentCode, info.Position); if (AutoCommand) { Selector.Add(agent); } } } if (AutoCommand) { //Find average of spawn positions Vector2d battlePos = Vector2d.zero; for (int i = 0; i < Spawns.Length; i++) { battlePos += Spawns [i].Position; } battlePos /= Spawns.Length; Command com = new Command(Lockstep.Data.AbilityDataItem.FindInterfacer <Scan> ().ListenInputID); com.Add <Vector2d> (battlePos); PlayerManager.SendCommand(com); Selector.Clear(); } }
public static void Initialize() { InstanceManagers.FastClear(); GlobalAgentActive.Clear(); OpenGlobalIDs.FastClear(); PeakGlobalID = 0; foreach (FastStack <LSAgent> cache in CachedAgents.Values) { for (int j = 0; j < cache.Count; j++) { cache.innerArray [j].SessionReset(); } } AgentController.DefaultController = AgentController.Create(); }
protected override void OnGameStart() { for (int i = 0; i < Spawns.Length; i++) { SpawnInfo info = Spawns [i]; while (AgentController.InstanceManagers.Count <= info.ControllerIndex) { AgentController cont = AgentController.Create(); AgentControllerTool.SetFullHostile(cont); PlayerManager.AddController(cont); } AgentController controller = AgentController.InstanceManagers [info.ControllerIndex]; //add default controller if necessary if (info.ControllerIndex == 0) { PlayerManager.AddController(controller); } for (int j = 0; j < info.Count; j++) { LSAgent agent = controller.CreateAgent(info.AgentCode, info.Position); if (AutoCommand) { Selector.Add(agent); } } } if (AutoCommand) { //Find average of spawn positions Vector2d battlePos = Vector2d.zero; for (int i = 0; i < Spawns.Length; i++) { battlePos += Spawns [i].Position; } battlePos /= Spawns.Length; Command com = new Command(Lockstep.Data.AbilityDataItem.FindInterfacer <Scan> ().ListenInputID); com.Add <Vector2d> (battlePos); PlayerManager.SendCommand(com); Selector.Clear(); } }
public void Initialize() { Diplomacy.FastClear(); for (int i = 0; i < TeamManager.Teams.Count; i++) { Team team = TeamManager.Teams[i]; if (team != this) { this.SetAllegiance(team, AllegianceType.Neutral); } } TeamManager.UpdateDiplomacy(this); TeamManager.Teams.Add(this); this.SetAllegiance(this, AllegianceType.Friendly); MainController = AgentController.Create(); MainController.JoinTeam(this); }
public static AgentController CreateController() { AgentController ac = AgentController.Create(); return(ac); }