Ejemplo n.º 1
0
    /*
     * getPathStartingWithForward method gets the final path from the agent to the connecting node found by the
     *      search from the agent to the goal then gets the final path for the goal
     * Parameter:	none
     * Return:	none
     */
    void getPathStartingWithForward()
    {
        AIPolygon[] frontPath = agentToGoal.getFinalPath();
        if (frontPath == null)
        {
            return;
        }
        AIPolygon[] backPath = goalToAgent.getFinalPathStartingWithNode(agentToGoal.getFinalPathStart());
        finalSolutionArray = new AIPolygon[frontPath.Length + backPath.Length - 1];
        int finalSolutionCounter = 0;

        for (int count = 0; count < frontPath.Length; count++, finalSolutionCounter++)
        {
            if (frontPath[count] != null)
            {
                finalSolutionArray [finalSolutionCounter] = frontPath [count];
            }
        }
        for (int count = 1; count < backPath.Length; count++, finalSolutionCounter++)
        {
            if (backPath[count] != null)
            {
                finalSolutionArray [finalSolutionCounter] = backPath [count];
            }
        }
    }
Ejemplo n.º 2
0
 /*
  * 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();
 }