예제 #1
0
    private void Awake()
    {
        GridMap.SetNodeSize(1, 1);
        TSRandom.Init();
        _pfm = new PathFindingManager(1);
        //_pm = PathManager.Instance;
        _gridGraph._mapSizeX = 50;
        _gridGraph._mapSizeZ = 50;
        _gridGraph._startPos = TSVector.zero;
        _gridGraph.SetUpMap();

        _map = _gridGraph._map;    //GridMapManager.Instance.CreateGridMap(50, 50, TSVector.zero, 0, this.IsTileUnWalkable);
        PathFindingAgentBehaviour.C_DESIRED_DELTATIME = 18;
        s_AstarAgent = new SingleObjectPool <PathFindingAgentBehaviour>(10);
    }
예제 #2
0
        void RandCreateBalls()
        {
            TSRandom.Init();
            FP halfx = TableWidth / 2 - 2 * radius - 5;
            FP halfy = TableHeight / 2 - 2 * radius - 5;

            for (int i = 0; i < 20; i++)
            {
                var ball = new BallObj(i, new TSVector2(TSRandom.Range((int)(-halfx), (int)halfx), TSRandom.Range((int)(-halfy), (int)halfy)), new TSVector2(TSRandom.Range(-1, 1), TSRandom.Range(-1, 1)).normalized, TSRandom.Range(10, 100), radius);
                //var ball = new BallObj(i, new TSVector2(TSRandom.Range((int)(-halfx), (int)halfx), TSRandom.Range((int)(-halfy), (int)halfy)), radius);
                balls.Add(ball);
                if (ball.ID == 0)
                {
                    mainBall = ball;
                }
            }
        }