it fricken works!

This commit is contained in:
2021-03-02 19:08:10 -06:00
parent 3da187be17
commit 2e976c01e9
6 changed files with 41 additions and 32 deletions

View File

@@ -72,19 +72,20 @@ namespace PathFinding
foreach (var path in element.GetPaths())
{
var shouldPath = true;
var next = Vector2.Add(from, path.Direction);
var next = Vector2.Add(from, path.Direction); ;
while (shouldPath && next.X < width && next.Y < height && next.X >= 0 && next.Y >= 0)
{
var collider = collection[(int)next.X, (int)next.Y];
if (collider != null)
{
callback(collider, next);
shouldPath = false;
}
next = Vector2.Add(from, path.Direction);
if (path.Distance == Distance.OneStep)
{
shouldPath = false;
}
next = Vector2.Add(next, path.Direction);
}
}
}