/* updateNode updates the parent of a node and the gFromStartingNodeCost of a node
     * Parameter:	(AIDynamicWeightedSearchNode) nodeToUpdate is the node to be updated
     *              (AIDynamicWeightedSearchNode) newParentNode is the new parent of the node to be updated
     *              (float) newCost is the new gFromStartingNodeCost of the node to be updated
     * Return: none
     */
    public void updateNode(AIDynamicWeightedSearchNode nodeToUpdate, AIDynamicWeightedSearchNode newParentNode, float newCost)
    {
        AIPolygon temp = nodeToUpdate.getPolygon();

        deleteNodeOfId(nodeToUpdate.getPolygon().getID());
        addNode(temp, newParentNode, newCost);
    }
 /*
  * 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++;
     }
 }
    /* popNode removes and returns the node at the front of the list (node with lowest fToatlCost value)
     * Parameter: none
     * Return: (AIDynamicWeightedSearchNode)
     *				node that was removed from the front of this list
     */
    public AIDynamicWeightedSearchNode popNode()
    {
        if (numberOfNodesHeld == 0)
        {
            return(null);
        }
        AIDynamicWeightedSearchNode tempNode = heap [0];

        indicesArray [tempNode.getPolygon().getID()] = -1;
        numberOfNodesHeld--;
        heap [0] = heap [numberOfNodesHeld];
        indicesArray [heap [0].getPolygon().getID()] = 0;
        if (numberOfNodesHeld > 0)
        {
            shiftDown(0);
        }
        return(tempNode);
    }