Conversion Node -> PathNode
This commit is contained in:
parent
89d57f5147
commit
daa88e5d24
@ -14,7 +14,7 @@ public class Pathfinder
|
||||
try
|
||||
{
|
||||
startRegion = regionManager.GetRegion(start);
|
||||
startNode = (PathNode)ClosestNodeToCoordinates(start, startRegion)!; //TODO null handling
|
||||
startNode = PathNode.FromNode(ClosestNodeToCoordinates(start, startRegion)!); //TODO null handling
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
@ -23,7 +23,7 @@ public class Pathfinder
|
||||
try
|
||||
{
|
||||
goalRegion = regionManager.GetRegion(goal);
|
||||
goalNode = (PathNode)ClosestNodeToCoordinates(goal, goalRegion)!; //TODO null handling
|
||||
goalNode = PathNode.FromNode(ClosestNodeToCoordinates(goal, goalRegion)!); //TODO null handling
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
@ -47,7 +47,7 @@ public class Pathfinder
|
||||
|
||||
foreach (Connection connection in closestNodeToGoal.GetConnections())
|
||||
{
|
||||
PathNode? neighbor = (PathNode?)regionManager.GetNode(connection.endNodeCoordinates);
|
||||
PathNode? neighbor = (PathNode)regionManager.GetNode(connection.endNodeCoordinates);
|
||||
if (neighbor != null && neighbor.currentPathWeight < closestNodeToGoal.currentPathWeight + Utils.DistanceBetween(closestNodeToGoal, neighbor))
|
||||
{
|
||||
neighbor.previousPathNode = closestNodeToGoal;
|
||||
|
Loading…
Reference in New Issue
Block a user