Esempio n. 1
0
    public override void Initialize(LSAgent agent)
    {
        MyMovementGroupID = -1;

        Body            = agent.Body;
        Body.Mover      = this;
        Body.OnContact += HandleCollision;


        Turner = agent.GetAbility <Turn> ();

        timescaledSpeed = ((Speed * LockstepManager.Timestep) >> FixedMath.SHIFT_AMOUNT);
        closingDistance = agent.Body.Radius;

        RepathCount       = LSUtility.GetRandom(RepathRate);
        ViableDestination = false;
    }
    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);
    }