static void AnalyzeNode() { if (!GridHeap.Contains(neighbor)) { AddBestNode(); GridHeap.Add(neighbor); } else if (newMovementCostToNeighbor < neighbor.gCost) { AddBestNode(); GridHeap.UpdateItem(neighbor); } }
static void AnalyzeNode() { if (!GridHeap.Contains(neighbor)) { neighbor.gCost = newMovementCostToNeighbor; //Optimized heuristic calculation neighbor.CalculateHeuristic(); neighbor.parent = currentNode; GridHeap.Add(neighbor); } else if (newMovementCostToNeighbor < neighbor.gCost) { neighbor.gCost = newMovementCostToNeighbor; //Optimized heuristic calculation neighbor.CalculateHeuristic(); neighbor.parent = currentNode; GridHeap.UpdateItem(neighbor); } }