コード例 #1
0
 /*
  * getPathFromBiDirectionAgent method will get the final path solution array from one of the searchs that was passed in
  * Parameter:	(AIDynBiDirOpAgent) agentThatFoundPath is the agent that has found the path to its goal
  * Return:	none
  */
 void getPathFromBiDirectionAgent(AIDynBiDirOpAgent 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();
 }
コード例 #2
0
    /*
     * getPathFromBothBiDirectionAgents method will get the final path from the two searchs depending on what agent
     *      found the connecting path
     * Parameter:	(bool)isStartBackwards tells which search found the path
     * Return:	none
     */
    void getPathFromBothBiDirectionAgents(bool isStartBackwards)
    {
        if (isStartBackwards == false)         //starting from search from the agent to the goal
        {
            getPathStartingWithForward();
        }
        else         //starting from the search fromt the goal to the agent
        {
            getPathStartingWithbackwards();
        }

        polygonFinalCount = agentToGoal.getFinalPathLength() + goalToAgent.getFinalPathLength() - 1;
        for (int count = 1; count < finalSolutionArray.Length; count++)
        {
            finalPathCost += (finalSolutionArray [count].getCenterVector() - finalSolutionArray [count - 1].getCenterVector()).magnitude;
        }
        nodesVisited = agentToGoal.getNodesVisited() + goalToAgent.getNodesVisited();
        maxQueueSize = agentToGoal.getMaxQueueSize() + goalToAgent.getMaxQueueSize();
    }