/*
  * getPathFromBiDirectionAgent method will get the final path solution array from one of the searchs that was passed in
  * Parameter:	(AIDynBiDirBeamOpAgent) agentThatFoundPath is the agent that has found the path to its goal
  * Return:	none
  */
 void getPathFromBiDirectionAgent(AIDynBiDirBeamOpAgent 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();
 }
Esempio n. 2
0
 /* AIDynBiDirBeamOpList method is a constructor for this class. It will set up the initial values for the search
  * Parameter:	(Vector3) goalPositionToAdd
  *              (int) polygonArrayLength is the length of the polygonArray from the navigation mesh
  *              (AIDynBiDirBeamOpAgent)searchToAdd is the agent using this list object
  */
 public AIDynBiDirBeamOpList(Vector3 goalPositionToAdd, int polygonArrayLength, AIDynBiDirBeamOpAgent searchToAdd)
 {
     search            = searchToAdd;
     numberOfNodesHeld = 0;
     goalPosition      = goalPositionToAdd;
     inList            = new bool[polygonArrayLength];
     indicesArray      = new int[polygonArrayLength];
     heap = new AIDynBiDirBeamOpNode[polygonArrayLength];
     for (int count = 0; count < polygonArrayLength; count++)
     {
         inList [count] = false;
         heap [count]   = null;
     }
 }
 /*
  * AIDynBiDirBeamOpSearch'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 AIDynBiDirBeamOpSearch(Vector3 goalToAdd, AIPolygon[] polygonArrayToAdd)
 {
     polygonArray      = polygonArrayToAdd;
     polygonFinalCount = 0;
     maxQueueSize      = 0;
     nodesVisited      = 0;
     finalPathCost     = 0f;
     for (int count = 0; count < polygonArray.Length; count++)         // looks for the polygon with the agent GameObject inside it
     {
         if (polygonArray [count].getHasAgent() == true)
         {
             AIDynBiDirBeamOpSearch.startingH = (goalToAdd - polygonArray[count].getCenterVector()).magnitude;
         }
     }
     agentToGoal = new AIDynBiDirBeamOpAgent(goalToAdd, polygonArray, false);
     goalToAgent = new AIDynBiDirBeamOpAgent(AINavigationMeshAgent.agentStart, polygonArray, true);
 }