diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-31 08:22:44 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-31 08:22:44 -0300 |
| commit | dac21a6dcb74be03dc1cde0798d09042beb558c9 (patch) | |
| tree | 17dafdea2e6a093ded9374b286072c6a7006dd11 /scenes | |
| parent | bd6aea5e4b3a53f81deb9f40907e026f8edd0fd7 (diff) | |
xiii
Diffstat (limited to 'scenes')
| -rw-r--r-- | scenes/turn_manager.tscn | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/scenes/turn_manager.tscn b/scenes/turn_manager.tscn deleted file mode 100644 index 91aafbc..0000000 --- a/scenes/turn_manager.tscn +++ /dev/null @@ -1,62 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://dw7mnqhgwx03g"] - -[sub_resource type="CSharpScript" id="CSharpScript_4jeo4"] -script/source = "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); - } -} -" - -[node name="TurnManager" type="Node"] -script = SubResource("CSharpScript_4jeo4") |
