summaryrefslogtreecommitdiff
path: root/scripts/Actor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Actor.cs')
-rw-r--r--scripts/Actor.cs19
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