Advertisement
SteamGear

Untitled

Jun 18th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1.  void CheckAndEnqueueNode(int x, int y, List<Node> nodesToCheck, int distance)
  2.     {
  3.         if (IsNodeInGridBounds(x, y))
  4.         {
  5.             //Check if node is walkable, not queued for check and unchecked
  6.             if (grid[x, y].walkable && !grid[x, y].isEnqueued && !grid[x, y].check)
  7.             {
  8.                 //Enqueue node and set its distance
  9.                 nodesToCheck.Add(grid[x, y]);
  10.                 grid[x, y].isEnqueued = true;
  11.                 grid[x, y].distance = distance + 1;
  12.             }
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement