Exemplo n.º 1
0
    public static List <Vector2> GetPoints(Vector2 start, Vector2 end)
    {
        for (int i = 0; i < width; ++i)
        {
            for (int j = 0; j < height; ++j)
            {
                int id = JsonTest.getMe().GetStopPoint(i, j); // [i, j];

                MapMgr.getMe().mRoadPointArr[i][j] = MapMgr.canThroughByID(id);
            }
        }


        List <APoint> _ret = Astar.SearchRoad(GetAPointByPosition(start, TILEDMAP_TYPE.START), GetAPointByPosition(end, TILEDMAP_TYPE.END), MapMgr.getMe().mRoadPointArr);


        List <Vector2> retex = new List <Vector2>();

        foreach (var data in _ret)
        {
            Vector2 pos = GetVec2ByApoint(data);
            retex.Add(pos);
        }

        return(retex);
    }
Exemplo n.º 2
0
    public void init()
    {
        mRoadPointArr = new TILEDMAP_TYPE[width][];
        for (int i = 0; i < width; ++i)
        {
            this.mRoadPointArr[i] = new TILEDMAP_TYPE[height];
        }


        for (int i = 0; i < width; ++i)
        {
            for (int j = 0; j < height; ++j)
            {
                int id = JsonTest.getMe().GetStopPoint(i, j); // [i, j];

                this.mRoadPointArr[i][j] = MapMgr.canThroughByID(id);
            }
        }
    }