diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 19:32:36 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 19:32:36 -0300 |
| commit | ca782d7310f2df854a8727535ac92337c85ed445 (patch) | |
| tree | 7df571c01d48cac56fb8362d4d091bdd2a55c09a /scripts/TurnManager.cs | |
| parent | adb86dd1725276457c13e9a4d37372fda628dea3 (diff) | |
Gigantesco refactor
Diffstat (limited to 'scripts/TurnManager.cs')
| -rw-r--r-- | scripts/TurnManager.cs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/scripts/TurnManager.cs b/scripts/TurnManager.cs deleted file mode 100644 index ea9050e..0000000 --- a/scripts/TurnManager.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Godot; -using System; -using System.Collections.Generic; -using System.Reflection.Metadata.Ecma335; - -public partial class TurnManager : Node { - [Signal] - public delegate void turnBeginEventHandler(); - [Signal] - public delegate void turnEndEventHandler(); - - private Godot.Collections.Array<Node> actors = []; - private int index = 0; - - public int TurnCount { get; private set; } = 1; - - public void Tick() { - EmitSignal(SignalName.turnBegin); - - actors.Clear(); - actors = GetTree().GetNodesInGroup("TimeSlave"); - - index = -1; - NextActor(); - } - - private void NextActor() { - index++; - if (index >= actors.Count) { - EndTurn(); - return; - } - Actor currentActor = (Actor) actors[index]; - currentActor.Energy += currentActor.Speed; - ActorPerformAction(); - } - - private void ActorPerformAction() { - Actor currentActor = (Actor) actors[index]; - if (currentActor.Energy > 0) { - currentActor.PerformAction(); - } else { - NextActor(); - } - } - - public void OnActionEnd() { - ActorPerformAction(); - } - - private void EndTurn() { - TurnCount++; - EmitSignal(SignalName.turnEnd); - } -} |
