private bool allNodesWalkable(bool checkDynamicObstacles = false) { // If any path is not walkable then exits early with failure foreach (PathRouteNode node in nodes) { if (node.IsWalkable == false) { return(false); } // Check for dynamic obstacles if (checkDynamicObstacles == true) { // Check for valid grid if (grid != null && grid.CheckIndexOccupied != null) { // Check if the node is obstructed if (grid.CheckIndexOccupied(node.Index) == true) { return(false); } } } } // The path can be walked until the end return(true); }