public static bool FindPath(Vector2d Start, Vector2d End, FastList <GridNode> outputPath)
 {
     currentNode = GridManager.GetNode(Start.x, Start.y);
     if (currentNode.Unwalkable)
     {
         //If the start node is unwalkable, attempt to locate the nearest walkable node
         if (Start.x > currentNode.WorldPos.x)
         {
             IndexX = 1;
         }
         else
         {
             IndexX = -1;
         }
         if (Start.y > currentNode.WorldPos.y)
         {
             IndexY = 1;
         }
         else
         {
             IndexY = -1;
         }
         node1 = currentNode.NeighborNodes [GridNode.GetNeighborIndex(IndexX, IndexY)];
         if (node1 == null || node1.Unwalkable)
         {
             node1 = currentNode.NeighborNodes[GridNode.GetNeighborIndex(IndexX, 0)];
             if (node1 == null || node1.Unwalkable)
             {
                 node1 = currentNode.NeighborNodes[GridNode.GetNeighborIndex(0, IndexY)];
                 if (node1 == null || node1.Unwalkable)
                 {
                     return(false);
                 }
             }
         }
     }
     else
     {
         node1 = currentNode;
     }
     currentNode = GridManager.GetNode(End.x, End.y);
     if (currentNode.Unwalkable)
     {
         //If the start node is unwalkable, attempt to locate the nearest walkable node
         if (End.x > currentNode.WorldPos.x)
         {
             IndexX = 1;
         }
         else
         {
             IndexX = -1;
         }
         if (End.y > currentNode.WorldPos.y)
         {
             IndexY = 1;
         }
         else
         {
             IndexY = -1;
         }
         node2 = currentNode.NeighborNodes [GridNode.GetNeighborIndex(IndexX, IndexY)];
         if (node2 == null || node2.Unwalkable)
         {
             node2 = currentNode.NeighborNodes[GridNode.GetNeighborIndex(IndexX, 0)];
             if (node2 == null || node2.Unwalkable)
             {
                 node2 = currentNode.NeighborNodes[GridNode.GetNeighborIndex(0, IndexY)];
                 if (node2 == null || node2.Unwalkable)
                 {
                     return(false);
                 }
             }
         }
     }
     else
     {
         node2 = currentNode;
     }
     OutputPath = outputPath;
     return(FindPath(node1, node2, OutputPath));
 }