black_friday/Assets/Scripts/Pathfinder.cs
/// <summary>
/// Get the next node in the path
/// </summary>
/// <param name="goal">The final node that we wish to traverse to</param>
/// <param name="currentNode">The node we are currently on (or just passed)</param>
/// <returns>The next node in the path</returns>
Get the next node in the path
Get the next node in the path
public PathNode FindNextNodeInPath(PathNode goal, PathNode currentNode)
        {
            PathNode closestNode = goal;
            while (closestNode.Parent[id] != null && closestNode.Parent[id] != currentNode)
            {
                closestNode = closestNode.Parent[id];
            }
            return closestNode;
        }
public PathNode FindNextNodeInPath ( PathNode goal , PathNode currentNode ) { PathNode closestNode = goal ; while ( closestNode . Parent [ id ] != null && closestNode . Parent [ id ] != currentNode ) { closestNode = closestNode . Parent [ id ] ; } return closestNode ; }
Get the next node in the path
Get the next node in the path
The next node in the path
The next node in the path
goal
PathNode
The final node that we wish to traverse to
The final node that we wish to traverse to
currentNode
PathNode
The node we are currently on (or just passed)
The node we are currently on ( or just passed )