conveyor placement rework

This commit is contained in:
Janis
2022-05-31 18:15:35 +02:00
parent 6f836a21e8
commit 4ac45a1d9d
4 changed files with 90 additions and 2 deletions

View File

@@ -126,7 +126,7 @@ public class Pathfinding
return null;
}
private List<PathNode> GetNeighbourList(PathNode currentNode)
public List<PathNode> GetNeighbourList(PathNode currentNode)
{
List<PathNode> neighbourList = new List<PathNode>();
@@ -175,6 +175,14 @@ public class Pathfinding
return path;
}
public int CalculateDistance(PathNode a, PathNode b)
{
int xDistance = Mathf.Abs(a.x - b.x);
int yDistance = Mathf.Abs(a.y - b.y);
int remaining = Mathf.Abs(xDistance - yDistance);
return Mathf.Min(xDistance, yDistance) + remaining;
}
private int CalculateDistanceCost(PathNode a, PathNode b)
{
int xDistance = Mathf.Abs(a.x - b.x);