summaryrefslogtreecommitdiff
path: root/scripts/entities/actors/actions/MovementAction.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-04 16:18:17 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-04 16:18:17 -0300
commit9953c9a5818baa392a48a4d18339c73f3b7a814e (patch)
tree3484fbca78bfa217d84226cc774119fe054f6df9 /scripts/entities/actors/actions/MovementAction.cs
parent7dbe2bbe431f77deb3515e5cf0810cfa07215d59 (diff)
Prepare
Diffstat (limited to 'scripts/entities/actors/actions/MovementAction.cs')
-rw-r--r--scripts/entities/actors/actions/MovementAction.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/entities/actors/actions/MovementAction.cs b/scripts/entities/actors/actions/MovementAction.cs
new file mode 100644
index 0000000..3608357
--- /dev/null
+++ b/scripts/entities/actors/actions/MovementAction.cs
@@ -0,0 +1,24 @@
+using Godot;
+
+/// <summary>
+/// Ação de movimento. Movimenta o ator para a direção de seu Offset.
+/// </summary>
+public partial class MovementAction : DirectionalAction
+{
+ public MovementAction(Actor actor, Vector2I offset) : base(actor, offset)
+ {
+ }
+
+ public override void Perform()
+ {
+ // Não anda se o destino for um tile sólido.
+ if (!Map_Data.IsTileWalkable(Destination)) return;
+
+ // Não anda se o destino for oculpado por um ator.
+ // Na maioria dos casos, essa condição nunca é verdadeira.
+ if (GetTargetActor() != null) return;
+
+ actor.Walk(Offset);
+ actor.Energy -= cost;
+ }
+}