Salvage dungeons (#14520)
This commit is contained in:
@@ -16,12 +16,25 @@ public sealed partial class PathfindingSystem
|
||||
return dx + dy;
|
||||
}
|
||||
|
||||
public float ManhattanDistance(Vector2i start, Vector2i end)
|
||||
{
|
||||
var distance = end - start;
|
||||
return Math.Abs(distance.X) + Math.Abs(distance.Y);
|
||||
}
|
||||
|
||||
public float OctileDistance(PathPoly start, PathPoly end)
|
||||
{
|
||||
var (dx, dy) = GetDiff(start, end);
|
||||
return dx + dy + (1.41f - 2) * Math.Min(dx, dy);
|
||||
}
|
||||
|
||||
public float OctileDistance(Vector2i start, Vector2i end)
|
||||
{
|
||||
var diff = start - end;
|
||||
var ab = Vector2.Abs(diff);
|
||||
return ab.X + ab.Y + (1.41f - 2) * Math.Min(ab.X, ab.Y);
|
||||
}
|
||||
|
||||
private Vector2 GetDiff(PathPoly start, PathPoly end)
|
||||
{
|
||||
var startPos = start.Box.Center;
|
||||
|
||||
Reference in New Issue
Block a user