Ejemplo n.º 1
0
 /*
  * AIBiDirectionalSearchOp's constructor will set up the initial values for the searchs
  * Parameter:	(Vector3)goalToAdd is the position of the goal in the scene
  *              (AIPolygon[])polygonArrayToAdd is the array that holds the polygons from the navigation mesh
  */
 public AIBiDirectionalSearchOp(Vector3 goalToAdd, AIPolygon[] polygonArrayToAdd)
 {
     polygonArray      = polygonArrayToAdd;
     polygonFinalCount = 0;
     maxQueueSize      = 0;
     nodesVisited      = 0;
     finalPathCost     = 0f;
     agentToGoal       = new AIBiDirectionalAStarAgentOp(goalToAdd, polygonArray, false);
     goalToAgent       = new AIBiDirectionalAStarAgentOp(AINavigationMeshAgent.agentStart, polygonArray, true);
 }
Ejemplo n.º 2
0
 /*
  * getPathFromBiDirectionAgent method will get the final path solution array from one of the searchs that was passed in
  * Parameter:	(AIBiDirectionalAStarAgentOp) agentThatFoundPath is the agent that has found the path to its goal
  * Return:	none
  */
 void getPathFromBiDirectionAgent(AIBiDirectionalAStarAgentOp agentThatFoundPath)
 {
     finalSolutionArray = agentThatFoundPath.getFinalPath();
     polygonFinalCount  = agentThatFoundPath.getFinalPathLength();
     for (int count = 1; count < finalSolutionArray.Length; count++)
     {
         finalPathCost += (finalSolutionArray [count].getCenterVector() - finalSolutionArray [count - 1].getCenterVector()).magnitude;
     }
     nodesVisited = agentThatFoundPath.getNodesVisited();
     maxQueueSize = agentThatFoundPath.getMaxQueueSize();
 }