本文整理汇总了C#中Heap.UpdateItem方法的典型用法代码示例。如果您正苦于以下问题:C# Heap.UpdateItem方法的具体用法?C# Heap.UpdateItem怎么用?C# Heap.UpdateItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Heap
的用法示例。
在下文中一共展示了Heap.UpdateItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindRoadPath
List<Point> FindRoadPath(Road a, Road b, RoadType T)
{
AstarObject[,] Set = new AstarObject[14, 9];
for (int x = 0; x < 14; x++)
{
for (int y = 0; y < 9; y++)
{
Set[x, y] = new AstarObject(x, y, this);
}
}
Heap<AstarObject> OpenSet = new Heap<AstarObject>(14 * 9);
HashSet<AstarObject> ClosedSet = new HashSet<AstarObject>();
AstarObject Start = Set[a.X, a.Y];
AstarObject End = Set[b.X, b.Y];
OpenSet.Add(Start);
while (OpenSet.Count > 0)
{
AstarObject CurrentLocation = OpenSet.RemoveFirst();
ClosedSet.Add(CurrentLocation);
if (CurrentLocation == End)
{
return RetracePath(Start, End);
//Retracepath and stuff.
}
List<AstarObject> Neighbours = GetNeighbours(CurrentLocation, ref Set, NeighbourhoodType.Neumann, MapsizeXR, MapsizeYR);
foreach (AstarObject neighbour in Neighbours)
{
if (neighbour.RType != T || ClosedSet.Contains(neighbour))
{
continue;
}
int newMovementCostToNeighbour = CurrentLocation.gCost + GetDistance(CurrentLocation, neighbour);
if (newMovementCostToNeighbour < neighbour.gCost || !OpenSet.Contains(neighbour))
{
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, End);
neighbour.parent = CurrentLocation;
if (!OpenSet.Contains(neighbour))
{
OpenSet.Add(neighbour);
}
else
{
OpenSet.UpdateItem(neighbour);
}
}
}
}
return new List<Point>();
}
示例2: FindPath
IEnumerator FindPath(Vector3 startPos, Vector3 targetPos)
{
Stopwatch sw = new Stopwatch();
sw.Start();
Vector3[] waypoints = new Vector3[0];
bool pathSuccess = false;
Node startNode = grid.NodeFromWorldPoint(startPos);
Node targetNode = grid.NodeFromWorldPoint(targetPos);
if (startNode.walkable && targetNode.walkable)
{
Heap<Node> openSet = new Heap<Node>(grid.MaxSize);
HashSet<Node> closedSet = new HashSet<Node>();
openSet.Add(startNode);
while (openSet.Count > 0)
{
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode == targetNode)
{
sw.Stop();
print ("Path found: " + sw.ElapsedMilliseconds + " ms");
pathSuccess = true;
break;
}
foreach (Node neighbour in grid.GetNeighbours(currentNode))
{
if (!neighbour.walkable || closedSet.Contains(neighbour))
{
continue;
}
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour) + neighbour.movementPenalty;
if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour))
{
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = currentNode;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem (neighbour);
}
}
}
}
yield return null;
if (pathSuccess) {
waypoints = RetracePath(startNode,targetNode);
}
requestManager.FinishedProcessingPath(waypoints,pathSuccess);
}
示例3: FindPath
void FindPath(Vector3 startPos, Vector3 targetPos) { // performs A* search on the grid to find a path
startPos = new Vector3(startPos.x + 8.0f, 0, startPos.z - 2.0f); // offsets
targetPos = new Vector3(targetPos.x + 8.0f, 0, targetPos.z - 2.0f); // offsets
Node startNode = grid.GetNodeFromWorldPoint(startPos);
Node targetNode = grid.GetNodeFromWorldPoint(targetPos);
if (targetNode.walkable == false) return; // don't try to path find if we're on an unwalkable area
Heap<Node> openSet = new Heap<Node>(grid.MaxSize);
HashSet<Node> closedSet = new HashSet<Node>();
openSet.Add(startNode);
while(openSet.Count > 0) { // we still have nodes
Node currentNode = openSet.pop();
closedSet.Add(currentNode);
if(currentNode == targetNode) { // we've found exit
RetracePath(startNode, targetNode);
path = backTrackPath(startNode, targetNode);
return;
}
foreach(Node n in grid.GetNeighbours(currentNode)) {
if (!n.walkable || closedSet.Contains(n)) continue;
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, n);
if(newMovementCostToNeighbour < n.gCost || !openSet.contains(n)) {
n.gCost = newMovementCostToNeighbour;
n.hCost = GetDistance(n, targetNode);
n.parent = currentNode;
if (!openSet.contains(n)) openSet.Add(n); // add our neighbour into open set
else openSet.UpdateItem(n);
}
}
}
}
示例4: aStar
public void aStar(Vector3 startPos, Vector3 endPos)
{
Stopwatch watch = new Stopwatch();
watch.Start();
//List<Node_K> openSet = new List<Node_K>();
Heap<Node_K> openSet = new Heap<Node_K>(AIarea.GetMaxSize);
HashSet<Node_K> closedSet = new HashSet<Node_K>();
Node_K sourceNode = AIarea.getNodeAtPos(startPos);
Node_K targetNode = AIarea.getNodeAtPos(endPos);
openSet.Add(sourceNode);
while(openSet.Count > 0)
{
Node_K currentNode = openSet.RemoveFirst();
//Node_K currentNode = openSet[0];
//for (int i = 1; i < openSet.Count; i++)
//{
// if (openSet[i].fCost < currentNode.fCost || openSet[i].fCost == currentNode.fCost && openSet[i].hCost < currentNode.hCost)
// {
// currentNode = openSet[i];
// }
//}
//openSet.Remove(currentNode);
closedSet.Add(currentNode);
if(currentNode == targetNode)
{
reversePath(sourceNode, targetNode);
watch.Stop();
time = watch.ElapsedMilliseconds.ToString();
print("Astar " + watch.ElapsedMilliseconds + "ms");
return;
}
List<Node_K> neighbors = new List<Node_K>();
neighbors = AIarea.neighbors(currentNode);
for (int i = 0; i < neighbors.Count; i++)
{
if (neighbors[i].walkable == false || closedSet.Contains(neighbors[i]))
continue;
int cost = currentNode.gCost + moveCost(currentNode, neighbors[i]);
if (!openSet.Contains(neighbors[i]) || (cost < neighbors[i].gCost))
{
neighbors[i].gCost = cost;
neighbors[i].hCost = moveCost(neighbors[i], targetNode);
neighbors[i].parent = currentNode;
if (!openSet.Contains(neighbors[i]))
openSet.Add(neighbors[i]);
else
openSet.UpdateItem(neighbors[i]);
}
}
}
}
示例5: FindPath
IEnumerator FindPath(Vector3 startPos, Vector3 targetPos)
{
Vector3[] waypoints = new Vector3[0];
bool pathSuccess = false;
Node startNode = grid.NodeFromWorlPoint (startPos);
Node targetNode = grid.NodeFromWorlPoint (targetPos);
if (startNode.Walkable && targetNode.Walkable)
{
Heap<Node> openSet = new Heap<Node>(grid.MaxSize);
HashSet<Node> closedSet = new HashSet<Node>();
openSet.Add(startNode);
while (openSet.Count > 0)
{
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode == targetNode)
{
pathSuccess = true;
break;
}
foreach (Node neighbour in grid.GetNeighbours(currentNode))
{
if (!neighbour.Walkable || closedSet.Contains(neighbour))
continue;
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour);
if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour))
{
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.Parent = currentNode;
if (!openSet.Contains(neighbour))
{
openSet.Add(neighbour);
}
else
openSet.UpdateItem(neighbour);
}
}
}
yield return null;
if (pathSuccess)
{
waypoints = RetracePath(startNode, targetNode);
}
requestManager.FinishedProcessingPath(waypoints, pathSuccess);
} else {
requestManager.FinishedProcessingPath(waypoints, pathSuccess);
yield break;
}
}
示例6: CalculatePath
//A* implementation
public static IEnumerator CalculatePath(PathNode startNode, PathNode endNode, PathNode[] allNodes, Action<Vector2[], bool> callback){
#if DEBUG
Stopwatch sw = new Stopwatch();
sw.Start();
#endif
var openList = new Heap<PathNode>(allNodes.Length);
var closedList = new HashSet<PathNode>();
var success = false;
openList.Add(startNode);
while (openList.Count > 0){
var currentNode = openList.RemoveFirst();
closedList.Add(currentNode);
if (currentNode == endNode){
#if DEBUG
sw.Stop();
//UnityEngine.Debug.Log("Path Found: " + sw.ElapsedMilliseconds + " ms.");
#endif
success = true;
break;
}
foreach (var neighbour in currentNode.links.Select( index => allNodes[index] )){
if (closedList.Contains(neighbour))
continue;
var costToNeighbour = currentNode.gCost + GetDistance( currentNode, neighbour );
if (costToNeighbour < neighbour.gCost || !openList.Contains(neighbour) ){
neighbour.gCost = costToNeighbour;
neighbour.hCost = GetDistance(neighbour, endNode);
neighbour.parent = currentNode;
if (!openList.Contains(neighbour)){
openList.Add(neighbour);
openList.UpdateItem(neighbour);
}
}
}
}
yield return null;
if (success){
callback( RetracePath(startNode, endNode), true );
} else {
callback( new Vector2[0], false );
}
}
示例7: FindPath
Vector2[] FindPath(Vector2 from, Vector2 to)
{
Stopwatch sw = new Stopwatch();
sw.Start();
Vector2[] waypoints = new Vector2[0];
bool pathSuccess = false;
Node startNode = grid.NodeFromWorldPoint(from);
Node targetNode = grid.NodeFromWorldPoint(to);
startNode.parent = startNode;
if (startNode.walkable && targetNode.walkable) {
Heap<Node> openSet = new Heap<Node>(grid.MaxSize);
HashSet<Node> closedSet = new HashSet<Node>();
openSet.Add(startNode);
while (openSet.Count > 0) {
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode == targetNode) {
sw.Stop();
print ("Path found: " + sw.ElapsedMilliseconds + " ms");
pathSuccess = true;
break;
}
foreach (Node neighbour in grid.GetNeighbours(currentNode)) {
if (!neighbour.walkable || closedSet.Contains(neighbour)) {
continue;
}
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour)+TurningCost(currentNode,neighbour);
if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) {
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = currentNode;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
}
if (pathSuccess) {
waypoints = RetracePath(startNode,targetNode);
}
return waypoints;
}
示例8: FindPath
void FindPath(Vector2 startPos, Vector2 targetPos)
{
Stopwatch sw = new Stopwatch();
sw.Start();
Node startNode = grid.NodeFromWorldPoint(startPos);
Node targetNode = grid.NodeFromWorldPoint(targetPos);
Heap<Node> openSet = new Heap<Node>(grid.MaxSize);
HashSet<Node> closedSet = new HashSet<Node>();
openSet.Add(startNode);
while(openSet.Count >0 )
{
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode== targetNode){
sw.Stop();
print("Path found" + sw.ElapsedMilliseconds + "ms");
RetracePath(startNode,targetNode);
return;
}
//check if neighbour is walkable
foreach(Node neighbour in grid.GetNeighbours(currentNode))
{
if(!neighbour.walkable || closedSet.Contains(neighbour))
{
continue;
}
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour);
if( newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)){
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = currentNode;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
}
示例9: FindPath
IEnumerator FindPath(Vector3 startPos, Vector3 targetPos)
{
//Create and start stopwatch to log method completion time
Stopwatch sw = new Stopwatch();
sw.Start();
//Initialize waypoints array
Vector3[] waypoints = new Vector3[0];
bool pathSuccess = false;
//Determine the start and target node based on the Gameobjects Vector 3 positions
Node startNode = grid.NodeFromWorldPoint(startPos);
Node targetNode = grid.NodeFromWorldPoint(targetPos);
if(startNode.walkable && targetNode.walkable) {
Heap<Node> openSet = new Heap<Node>(grid.MaxSize); //Holds all the nodes in the grid
HashSet<Node> closedSet = new HashSet<Node>(); //Used to store nodes that are
openSet.Add(startNode);
while (openSet.Count > 0) {
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode == targetNode) {
sw.Stop();
print("Path Found: " + sw.ElapsedMilliseconds + " ms");
pathSuccess = true;
break;
}
foreach(Node neighbour in grid.GetNeighbours(currentNode)) {
if(!neighbour.walkable || closedSet.Contains(neighbour)) {
continue;
}
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour) + neighbour.movementPenalty;
if(newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) {
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = currentNode;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
}
yield return null;
if (pathSuccess) {
waypoints = RetracePath(startNode, targetNode);
}
requestManager.FinishedProcessingPath(waypoints, pathSuccess);
}
示例10: FindPathImmediate
public bool FindPathImmediate(GridNode start, GridNode end, List<List<GridNode>> grid, out List<GridNode> path)
{
path = new List<GridNode>();
bool success = false;
if (start.walkable && end.walkable)
{
Heap<GridNode> openSet = new Heap<GridNode>(grid.Count * grid[0].Count);
HashSet<GridNode> closedSet = new HashSet<GridNode>();
openSet.Add(start);
while (openSet.Count > 0)
{
GridNode currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
//path found
if (currentNode == end)
{
success = true;
break;
}
foreach (GridNode neighbour in currentNode.GetNeighbours())
{
if (!neighbour.walkable || closedSet.Contains(neighbour))
continue;
int newNeighbourMoveCost = currentNode.gCost + GetDistanceManhatten(currentNode, neighbour);
if (newNeighbourMoveCost < neighbour.gCost || !openSet.Contains(neighbour))
{
neighbour.gCost = newNeighbourMoveCost;
neighbour.hCost = GetDistanceManhatten(neighbour, end);
neighbour.parent = currentNode;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
}
if (success)
{
path = RetracePath(start, end);
}
return success;
}
示例11: CreatePath
void CreatePath(Node startNode, Node targetNode)
{
bool pathSuccess = false;
int traffic;
int trafficCap;
openSet = new Heap<Node>(grid.RoadSet.Count);
closedSet = new HashSet<Node>();
openSet.Add(startNode);
while (openSet.Count > 0)
{
// remove the smallest fCost from Heap
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode == targetNode)
{
pathSuccess = true;
break;
}
foreach (Node neighbour in grid.PathGetRoadNeighbours(currentNode))
{
if (closedSet.Contains(neighbour))
continue;
lock (currentNode)
traffic = currentNode.trafficTimer.TrafficIntensity;
trafficCap = currentNode.trafficTimer.InitialTrafficIntensity;
int penalty = 17 - 17 * traffic / (trafficCap + 17/trafficCap);
int newMovementCostToNeighbor = currentNode.gCost + GetDistance(currentNode, neighbour) + penalty;
if (newMovementCostToNeighbor < neighbour.gCost || !openSet.Contains(neighbour))
{
neighbour.gCost = newMovementCostToNeighbor;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = currentNode;
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
requestManager.FinishedProcessingPath(ReverseParents(startNode, targetNode), pathSuccess);
}
示例12: CalculatePath
IEnumerator CalculatePath(Vector3 startPosition, Vector3 targetPosition, LongPathGrid longPathGrid)
{
Vector3[] waypoints = new Vector3[0];
bool pathSuccess = false;
GridNode startNode = longPathGrid.GetGridNodeFromWorldPoint(startPosition);
GridNode targetNode = longPathGrid.GetGridNodeFromWorldPoint(targetPosition);
if (targetNode.walkable) {
Heap<GridNode> openSet = new Heap<GridNode>(longPathGrid.MaxSize);
HashSet<GridNode> closedSet = new HashSet<GridNode>();
openSet.Add(startNode);
while(openSet.Count > 0) {
GridNode currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
if (currentNode == targetNode) {
pathSuccess = true;
break;
}
foreach (GridNode neighbour in longPathGrid.GetNeighbours(currentNode)) {
if (!neighbour.walkable || closedSet.Contains(neighbour)) {
continue;
}
int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour);
if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) {
neighbour.gCost = newMovementCostToNeighbour;
neighbour.hCost = GetDistance(neighbour, targetNode);
neighbour.parent = currentNode;
if(!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
}
yield return null;
if (pathSuccess)
waypoints = RetracePath(startNode, targetNode);
navGridManager.FinishProcessingLongPath(waypoints,pathSuccess);
}
示例13: FindPath
public List<Node> FindPath(Node start, Node destination)
{
// an open set to store nodes with the potentional to lead towards the goal
openSet = new Heap<Node>(game.nodeGrid.nodesInGridWidth * game.nodeGrid.nodesInGridHeight);
// a closed set to keep track of nodes already expanded from
closedSet = new HashSet<Node>();
openSet.Add(start);
// as long as the openset contains nodes we keep searching a path
while (openSet.Count > 0)
{
// get the node with the lowest F value
Node currentNode = openSet.RemoveFirst();
closedSet.Add(currentNode);
// if we find the goal, retrace our path and send it to the requester
if (currentNode == destination)
return RetracePath(start, destination);
// expand from the current node, get neighbours in all 8 directions
foreach (Node neighbour in game.nodeGrid.GetAllNeighbours(currentNode))
{
if (neighbour.blocked || closedSet.Contains(neighbour))
continue;
// the new cost is the current Node G value + the distance to the neighbour (either 10 or 14)
int newGCost = currentNode.G + GetDistance(currentNode, neighbour);
if (newGCost < neighbour.G || !openSet.Contains(neighbour))
{
neighbour.G = newGCost;
neighbour.H = GetDistance(neighbour, destination);
neighbour.parent = currentNode;
// the openSet maintains itself in such away that the node with the lowest F value is always the first element.
if (!openSet.Contains(neighbour))
openSet.Add(neighbour);
else
openSet.UpdateItem(neighbour);
}
}
}
// we went through every node we could reach and havent found the goal. it is unreachable
return null;
}
示例14: CalculatePath
//Calculates the path from a start to finish using the A* Pathfinding algorithm
IEnumerator CalculatePath(Vector3 startPosition, Vector3 endPosition)
{
Vector3[] waypoints = new Vector3[0];
bool success = false;
Node startNode = grid.NodeFromPoint(startPosition);//Creates a node from the point
Node endNode = grid.NodeFromPoint(endPosition);
if (endNode.Walkable ) { //See if the end node is a walkable object or it is a resource
Heap<Node> open = new Heap<Node> (grid.MaxGridSize);
HashSet<Node> closed = new HashSet<Node> ();
open.Add (startNode);
while (open.Count > 0) {
Node current = open.Pop ();//Removes first node in heap and re-sorts it
closed.Add (current);//Adds the node to the closed list
if (current == endNode) {
success = true;
break;
}
foreach (Node neighbour in grid.GetNeighbours(current)) {//Traverses through the neighbours of the nodes
if (!neighbour.Walkable || closed.Contains (neighbour)) {
continue;
}
int costToNeighbour = current.G + GetDist (current, neighbour);
if (costToNeighbour < neighbour.G || !open.Contains (neighbour)) {//If the cost to neighbour < neighbouring g value
neighbour.G = costToNeighbour;
neighbour.H = GetDist (neighbour, endNode);
neighbour.Parent = current;
if (!open.Contains (neighbour)) {
open.Add (neighbour); //Adds the neighbour to the heap
}
else{
open.UpdateItem(neighbour); // Resort the heap to include the neighbour
}
}
}
}
}
yield return null;//Makes wait for one frame
if (success) // If successfully calculates path
{
waypoints = ReversePath(startNode, endNode); //reverse path since path is stored from end to beginning
}
request.FinishedProcessing(waypoints, success);
}
示例15: Find
//Find the path (start = enemy ... end = player)
public void Find(Vector3 startPos, Vector3 endPos) {
//Get the world position for the enemy and player
Node start = decompScript.FromWorldPoint(startPos);
Node end = decompScript.FromWorldPoint(endPos);
//Heap for better performance when searching through nodes
//Open set is the set of nodes to be evaluated
Heap<Node> open = new Heap<Node>(decompScript.MaxSize);
//HashSet because we don't have to worry about searching through the closed set
//Closed set is the set of nodes that have already been evaluated
HashSet<Node> closed = new HashSet<Node>();
//Adds the start node to open set
open.Add(start);
//While the open set is NOT empty...
while (open.Count > 0) {
//Remove the current node from the open set
Node current = open.RemoveFirst ();
//Add to the closed set
closed.Add(current);
//If current node equals final node...
if (current == end) {
//Retrace to create the path
Retrace(start, end);
return;
}
//Check the nodes in the neighbors list
foreach (Node neighbor in decompScript.Neighbors(current)) {
//Skip node if UNWALKABLE or if in the closed list
if (!neighbor.walkable || closed.Contains(neighbor)) {
continue;
}
//New cost equals the current node's gCost plus the distance between the current node and neighbor
int newCostToNeighbor = current.gCost + Distance(current, neighbor);
//Compare new cost to that of the neighbors
if (newCostToNeighbor < neighbor.gCost || !open.Contains(neighbor)) {
//Set new gCost of neighbor
neighbor.gCost = newCostToNeighbor;
//Set new hCost of neighbor
neighbor.hCost = Distance(neighbor, end);
//Set the parent of the neighbor as the current node
neighbor.parent = current;
//If not already in the open set
if (!open.Contains (neighbor)) {
//Add neighbor
open.Add (neighbor);
} else {
//Update the sort of the item in the heap
open.UpdateItem (neighbor);
}
}
}
}
}