private void SetupMap() { var count = Map.Width * Map.Height; _map = new PathNode[count]; _closed = new PathNode[count]; _open = new PathQueue(count); foreach (var p in Map.Bounds.allPositionsWithin) { var index = Map.TileIndex(p); _map[index] = new PathNode() { X = p.x, Y = p.y, TileIndex = index, Walkable = !Map.IsBlocked(p) }; } }
public void SetupMap() { var width = Map.State.Width; var height = Map.State.Height; var count = width * height; _map = new PathNode[count]; _closed = new PathNode[count]; _open = new PathQueue(count); for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { var index = Map.TileIndex(x, y); var walkable = !Map.Blocked(index); _map[index] = new PathNode() { X = x, Y = y, TileIndex = index, Walkable = walkable }; } } }