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
+19 -9
View File
@@ -153,13 +153,7 @@ public partial class PegController : TurnController
}
if (CLICK_TYPE == 0)
{
List<Vector2I> newPath = peg.GetBestPath();
// pathLayer.GetUsedCells().ToList().ForEach(c => pathLayer.SetCell(c,0,Vector2I.Down*4));
// for (int i = 0; i < newPath.Count; i++)
// {
// pathLayer.SetCell(newPath[i],0,Vector2I.One);
// }
Map map = _playArea._map;
TileMapLayer pathLayer = _playArea.GetNode<TileMapLayer>("PathLayer");
List<Vector2I> pl = [.. pathLayer.GetUsedCells()];
@@ -172,10 +166,22 @@ public partial class PegController : TurnController
}
}
else if (CLICK_TYPE == 1)
{
TileMapLayer pathLayer = _playArea.GetNode<TileMapLayer>("PathLayer");
List<MapCell> newPath = peg.GetBestPath(true);
pathLayer.GetUsedCells().ToList().ForEach(c => pathLayer.SetCell(c,0,Vector2I.Down + Vector2I.Right*4));
for (int i = 0; i < newPath.Count; i++)
{
pathLayer.SetCell(newPath[i]._address,0,Vector2I.One);
}
}
else if (CLICK_TYPE == 2)
{
HandlePegRemoval(peg);
}
}
public void HandlePegRemoval(Peg PEG_TO_REMOVE)
@@ -201,6 +207,7 @@ public partial class PegController : TurnController
List<Vector2I> fPositions = [.. positions.Where(c => (int)init.GetCellTileData(c).GetCustomData("disposition") == 1)];
AddHostilePegs(hPositions);
AddFriendlyPegs(fPositions);
_playArea.HighlightCells();
}
public void ProcessTween()
@@ -227,7 +234,10 @@ public partial class PegController : TurnController
Peg peg = step.Item1;
PegAction action = step.Item2;
Tween tween = action.CreateAnimation(peg);
_tween.Parallel().TweenSubtween(tween);
if (tween != null)
{
_tween.Parallel().TweenSubtween(tween);
}
}
}
_tween.TweenCallback(Callable.From(EndTurn));
@@ -245,12 +255,12 @@ public partial class PegController : TurnController
HandlePegSort();
HandlePegTurn();
_playArea.HighlightCells();
}
public void SetPeg(Peg PEG, MapCell CELL)
{
_map.SetCellPeg(CELL, PEG);
PEG._cell = CELL;
PEG.GlobalPosition = CELL.GlobalPosition;
}