mirror of
https://github.com/Xevion/Paths.git
synced 2025-12-06 01:15:44 -06:00
fix unpausing during edits while paused, fixed end node changes not being rendered properly
This commit is contained in:
@@ -82,8 +82,7 @@ namespace Algorithms {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fix start and end position being overriden
|
||||
ChangeController.RemovePositions(start, 1);
|
||||
|
||||
|
||||
// if all good, return path
|
||||
Node temp = _closedList[_closedList.IndexOf(current)];
|
||||
@@ -95,6 +94,12 @@ namespace Algorithms {
|
||||
temp = temp.Parent;
|
||||
} while (temp != null && !temp.Equals(startNode));
|
||||
|
||||
// Fix start and end position being overriden
|
||||
// TODO: Look into using a proper fix for this instead of a 'patch'.
|
||||
ChangeController.RemovePositions(start, 1);
|
||||
ChangeController.RemovePositions(end, 3);
|
||||
|
||||
|
||||
return _path;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class UIController : MonoBehaviour {
|
||||
private AnimationState _previousAnimationState;
|
||||
|
||||
private bool EditShouldReload =>
|
||||
_animationState == AnimationState.Started || _animationState == AnimationState.Paused;
|
||||
_animationState == AnimationState.Started;
|
||||
|
||||
// Grid State & Pathfinding
|
||||
private NodeGrid _grid;
|
||||
@@ -95,7 +95,9 @@ public class UIController : MonoBehaviour {
|
||||
Node node = _grid.GetNode(position);
|
||||
_modify = node.Walkable ? ClickType.Add : ClickType.Remove;
|
||||
node.Walkable = !node.Walkable;
|
||||
if (EditShouldReload)
|
||||
if (_animationState == AnimationState.Paused)
|
||||
_animationState = AnimationState.Stopped;
|
||||
else if (_animationState == AnimationState.Started)
|
||||
_animationState = AnimationState.Reloading;
|
||||
}
|
||||
|
||||
@@ -230,7 +232,7 @@ public class UIController : MonoBehaviour {
|
||||
|
||||
string pathCount = _path != null ? $"{_path.Count}" : "N/A";
|
||||
debugText.text = $"{_state.CurrentRuntime * 1000.0:F1}ms\n" +
|
||||
$"{CurrentIndex + 1:000} / {_state.Count:000}\n" +
|
||||
$"{CurrentIndex:000} / {_state.Count:000}\n" +
|
||||
$"Path: {pathCount} tiles";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user