示例#1
0
        public IEnumerable <PathfindCell> GetGlobalPath(Vector2 globalFrom, Vector2 globalTo)
        {
            var fromId = _astar.GetClosestPoint(globalFrom / TILE_SIZE);
            var toId   = _astar.GetClosestPoint(globalTo / TILE_SIZE);
            var idPath = _astar.GetIdPath(fromId, toId);

            var offset = new Vector2(TILE_SIZE / 2f, TILE_SIZE);

            return(idPath.Select(x => new PathfindCell(x, _astar.GetPointWeightScale(x), _astar.GetPointPosition(x) * TILE_SIZE + offset)));
        }