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