Example #1
0
        public void LaunchSpawns()
        {
            for (int i = 0; i < Spawns.Length; i++)
            {
                SpawnInfo info = Spawns [i];

                var controller = AgentControllerHelper.Instance.GetInstanceManager(info.ControllerCode);

                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();
            }
        }
        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();
            }
        }
Example #3
0
        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();
            }
        }
 private static void Send(Command com)
 {
     IsGathering = false;
     PlayerManager.SendCommand(com);
 }