From b05cfd5577884d1a398dbb226e2082af5fe8f8fa Mon Sep 17 00:00:00 2001 From: Matheus Date: Sat, 16 Aug 2025 15:56:28 -0300 Subject: Sistema de turnos básico MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Actor.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'scripts/Actor.cs') 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 -- cgit v1.2.3