Ejemplo n.º 1
0
    void Start()
    {
        LockstepManager.Initialize ();
        GridManager.Generate ();
        const int count = 32;

        for (int i = -count; i < count; i++)
        {
            for (int j = -count; j < count; j++)
            {
                if (i * i + j * j < 16) continue;
                if (LSUtility.GetRandom (2) == 0)
                {
                    Vector2d pos = new Vector2d(i,j);
                    GridManager.GetNode(pos.x,pos.y).Unwalkable = true;
                    Instantiate(TestWall).GetComponent<LSBody>().Initialize(pos);
                }
            }
        }

        /*LSBody wall = Instantiate (TestWall).GetComponent<LSBody> ();
        wall.Initialize (new Vector2d (-32 + 14, 0));
        for (long i = wall.XMin; i <= wall.XMax; i+= FixedMath.One) {
            for (long j = wall.YMin; j <= wall.YMax; j+= FixedMath.One) {
                GridManager.GetNode (i, j).Unwalkable = true;
            }
        }*/

        GridManager.Initialize ();
        controller = AgentController.Create ();
        for (int i = 0; i < 256; i++) {
            agent = controller.CreateAgent (AgentCode.Minion);
        }
        PlayerManager.AddAgentController (controller);
    }
Ejemplo n.º 2
0
        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);
                        }
                    }
                }
            }
        }
Ejemplo n.º 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();
                    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();
            }
        }
Ejemplo n.º 4
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();
            }
        }