Example #1
0
        public List <Tile> FindPath(int sX, int sY, int eX, int eY)
        {
            GridPos start = new GridPos(sX, sY);
            GridPos end   = new GridPos(eX, eY);

            if (!_searchGrid.IsWalkableAt(end))
            {
                return(new List <Tile>());
            }
            jpParam.Reset(start, end, _searchGrid);
            List <GridPos> result  = JumpPointFinder.FindPath(jpParam);
            List <Tile>    result2 = new List <Tile>();

            foreach (GridPos gp in result)
            {
                result2.Add(_mapLayout[gp.x, gp.y]);
            }



            return(result2);
        }
Example #2
0
 /// <summary>
 /// 是否可以行走
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public bool GetWalkable(Vector2 p)
 {
     return(grids.IsWalkableAt((int)p.x, (int)p.y));
 }