Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // your tile class that inherits a PathNode
- public class MyTile : PathNode
- {
- public MyTile()
- {
- // passible by default
- IsPassible = true;
- }
- }
- // creating a grid with size "width" and "height"
- TileGrid<MyTile> grid = new TileGrid<MyTile>(width, height);
- // make (0, 1) impassible
- grid[0][1].IsPassible = false;
- // starting point
- Point start = new Point(0, 0);
- // destination point
- Point end = new Point(5, 5);
- // points along the shortest path. The last flag is whether or not to allow diagonal movement.
- List<Point> path = grid.FindPath(start, end, true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement