minor changes, next step is to add 2-3 friendly pegs, 2 neutral pegs, 2 hostile pegs, 2 buildings and all associated actions for these additions

This commit is contained in:
2026-07-01 02:36:31 -04:00
parent 2c289333f0
commit bbe9eefcfa
7 changed files with 106 additions and 31 deletions
+17 -5
View File
@@ -85,9 +85,10 @@ public partial class PegController : TurnController
{
action.DoImmediately(peg);
string key = action._priority + ":" + loop;
if (!_tweenStages.ContainsKey(key))
{
_tweenStages[key] = new();
_tweenStages[key] = new();
}
_tweenStages[key].Add(new(peg, action));
if (!anyPegsActed)
@@ -104,7 +105,6 @@ public partial class PegController : TurnController
public void HandlePegClick(Node CLICKED_NODE, int CLICK_TYPE)
{
TileMapLayer pathLayer = _playArea.GetNode<TileMapLayer>("PathLayer");
if (CLICKED_NODE is not Peg peg)
{
return;
@@ -113,10 +113,21 @@ public partial class PegController : TurnController
{
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.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()];
List<Vector2I> visible = peg.GetVisibleCells();
for (int i = 0; i < pl.Count; i++)
{
pathLayer.SetCell(newPath[i],0,Vector2I.One);
Vector2I cell = pl[i];
pathLayer.GetUsedCells().ToList().ForEach(c => pathLayer.SetCell(cell,0,Vector2I.Down + Vector2I.Right*(visible.IndexOf(cell) > -1 ? 1 : 4)));
}
}
else if (CLICK_TYPE == 2)
@@ -149,6 +160,7 @@ public partial class PegController : TurnController
public void ProcessTween()
{
_tweenStages = _tweenStages.OrderBy(s => int.Parse(s.Key.Split(":")[0])).ThenBy(s => int.Parse(s.Key.Split(":")[1])).ToDictionary();
if (_tweenStages.Count <= 0)
{
EndTurn();