switching up some more clicking

This commit is contained in:
2026-06-25 18:11:43 -04:00
parent 37da9a4e84
commit fc32baa071
9 changed files with 57 additions and 58 deletions
+22 -18
View File
@@ -20,8 +20,7 @@ public partial class PegController : TurnController
{
HostilePeg newHostilePeg = _hostilePegScene.Instantiate<HostilePeg>();
newHostilePeg.Death += HandlePegRemoval;
newHostilePeg.Clicked += HandlePegClick;
newHostilePeg.RightClicked += HandlePegRightClick;
newHostilePeg.Click += HandlePegClick;
newHostilePeg._stamina = Globals._rng.Next(2,4+1);
newHostilePeg.Modulate = new Color(newHostilePeg._stamina == 2 ? "#FF0000" : newHostilePeg._stamina == 3 ? "#00FF00" : "#0000FF");
@@ -39,8 +38,7 @@ public partial class PegController : TurnController
{
HostilePeg newHostilePeg = _hostilePegScene.Instantiate<HostilePeg>();
newHostilePeg.Death += HandlePegRemoval;
newHostilePeg.Clicked += HandlePegClick;
newHostilePeg.RightClicked += HandlePegRightClick;
newHostilePeg.Click += HandlePegClick;
newHostilePeg._stamina = Globals._rng.Next(2,4+1);
newHostilePeg._hitRange = Globals._rng.Next(1,2+1);
@@ -95,25 +93,31 @@ public partial class PegController : TurnController
}
public void HandlePegClick(Peg PEG)
public void HandlePegClick(Node CLICKED_NODE, int CLICK_TYPE)
{
if (PEG._staminaRemaining <= 0){
if (CLICKED_NODE is not Peg peg)
{
return;
}
TileMapLayer pathLayer = _playArea.GetNode<TileMapLayer>("PathLayer");
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++)
if (CLICK_TYPE == 0)
{
pathLayer.SetCell(newPath[i],0,Vector2I.One);
}
}
if (peg._staminaRemaining <= 0){
return;
}
TileMapLayer pathLayer = _playArea.GetNode<TileMapLayer>("PathLayer");
List<Vector2I> newPath = peg.GetBestPath();
public void HandlePegRightClick(Peg PEG)
{
HandlePegRemoval(PEG);
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);
}
}
else if (CLICK_TYPE == 2)
{
HandlePegRemoval(peg);
}
}
public void HandlePegPathing(Peg PEG)