still working out movement

This commit is contained in:
2026-07-04 03:04:56 -04:00
parent 336b72e4cb
commit dbafefd660
16 changed files with 136 additions and 71 deletions
+7 -7
View File
@@ -20,10 +20,10 @@ public partial class BasicMovement : PegAction
{
PegController pegController = PEG._pegController;
Map map = pegController._playArea._map;
Vector2I cell = PEG._path[0];
MapCell cell = PEG._path[0];
Tween subtween = CreateTween();
Vector2 target = map.GetCellPositionFromAddress(cell);
Vector2 target = cell.GlobalPosition;
subtween.TweenProperty(PEG, "global_position", target, 0.25f);
PEG._path.RemoveAt(0);
@@ -32,23 +32,23 @@ public partial class BasicMovement : PegAction
public override void DoImmediately(Peg PEG)
{
List<Vector2I> path = PEG.GetBestPath(true);
List<MapCell> path = PEG.GetBestPath(true);
PegController pegController = PEG._pegController;
Map map = pegController._playArea._map;
if (path?.Count == 0)
{
return;
}
Vector2I cell = path[0];
MapCell cell = path[0];
map.SetCellPeg(map._cells[cell], PEG);
map.SetCellPeg(cell, PEG);
PEG._path.Add(cell);
}
public override bool MeetsCriteria(Peg PEG)
{
List<Vector2I> bestPath = PEG.GetBestPath(true);
return base.MeetsCriteria(PEG) && bestPath.Count > 0 && (int)PEG._pegController._playArea._map.GetCellTileData(bestPath[0]).GetCustomData("disposition") != -(int)PEG._disposition;
List<MapCell> bestPath = PEG.GetBestPath(true);
return base.MeetsCriteria(PEG) && bestPath.Count > 0;
}