protected void FoundTarget (PathNode nodeR, int i) {
nodeR.flag1 = false; // Reset bit 8
Trace(nodeR);
vectorPaths[i] = vectorPath;
nodePaths[i] = path;
vectorPath = Util.ListPool<Vector3>.Claim();
path = Util.ListPool<GraphNode>.Claim();
targetsFound[i] = true;
targetNodeCount--;
// Since we have found one target
// and the heuristic is always set to None when
// pathsForAll is false, we will have found the shortest path
if (!pathsForAll) {
CompleteState = PathCompleteState.Complete;
targetNodeCount = 0;
return;
}
// If there are no more targets to find, return here and avoid calculating a new hTarget
if (targetNodeCount <= 0) {
CompleteState = PathCompleteState.Complete;
return;
}
RecalculateHTarget(false);
}