diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-16 15:56:28 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-16 15:56:28 -0300 |
| commit | b05cfd5577884d1a398dbb226e2082af5fe8f8fa (patch) | |
| tree | 26961e5c63e87c5d1c17422cdf6ab4493b2d8f55 /scripts/Actor.cs | |
| parent | c411c496394c7a782854e03f2be8fab4cc1e2a81 (diff) | |
Sistema de turnos básico
Diffstat (limited to 'scripts/Actor.cs')
| -rw-r--r-- | scripts/Actor.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/Actor.cs b/scripts/Actor.cs index fc69edf..b360545 100644 --- a/scripts/Actor.cs +++ b/scripts/Actor.cs @@ -1,8 +1,16 @@ using Godot; -public partial class Actor : Node2D { +public abstract partial class Actor : Node2D { + static int baseWalkCost = 10; [Export] public TileMapLayer Map { get; set; } + [Signal] + public delegate void actionPerformedEventHandler(); + + [Export] + public int Energy { get; set; } = 0; + [Export] + public int Speed { get; protected set; } = 10; protected void Walk(Vector2I offset) { Vector2I toMovePos = Map.LocalToMap(Position); @@ -14,5 +22,14 @@ public partial class Actor : Node2D { GD.Print(toMovePos); Position = Map.MapToLocal(toMovePos); } + + Energy -= baseWalkCost; + EndAction(); } + + protected virtual void EndAction() { + EmitSignal(SignalName.actionPerformed); + } + + public abstract void performAction(); }
\ No newline at end of file |
