Exemplo n.º 1
0
 //used for debugging
 void printSolutionRecusively(AIDynamicWeightedSearchNode currentNode)
 {
     if (currentNode != null)
     {
         printSolutionRecusively(currentNode.getParentNode());
         polygonFinalCount++;
     }
 }
Exemplo n.º 2
0
 /*
  * addFinalsolutionPolygons method is a recusive method that will look at the parent of each node passed in until
  *      the node passed in is null, then it will add each Node's polygon to the finalSolutionArray in order
  *      from start until end
  * Parameter:	(AIAgentAStarSearchNode)currentNode is the node that needs to be checked and then have its parent passed
  *              (ref int)counter is the current count of polygons in the FinalSolution array used to access the next index
  * Return:	none
  */
 void addFinalSolutionPolygons(AIDynamicWeightedSearchNode currentNode, ref int counter)
 {
     if (currentNode != null)
     {
         addFinalSolutionPolygons(currentNode.getParentNode(), ref counter);
         finalSolutionArray [counter] = currentNode.getPolygon();
         if (counter != 0)
         {
             finalPathCost += (finalSolutionArray[counter].getCenterVector() - finalSolutionArray[counter - 1].getCenterVector()).magnitude;
         }
         counter++;
     }
 }