summaryrefslogtreecommitdiff
path: root/scripts/actors/actions/BumpAction.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-28 00:38:48 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-28 00:38:48 -0300
commit2fb787a744d4f7a37d81233d2913a5ef39122f73 (patch)
treef9595d6757203146aa8201a86275c2c842bae03b /scripts/actors/actions/BumpAction.cs
parent6c7e2ac133986efa57b43df52a5498c6f7efcf75 (diff)
Comentarios
Diffstat (limited to 'scripts/actors/actions/BumpAction.cs')
-rw-r--r--scripts/actors/actions/BumpAction.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/actors/actions/BumpAction.cs b/scripts/actors/actions/BumpAction.cs
index 5958b11..def721b 100644
--- a/scripts/actors/actions/BumpAction.cs
+++ b/scripts/actors/actions/BumpAction.cs
@@ -1,6 +1,10 @@
using Godot;
-using System;
+/// <summary>
+/// Ação de "Esbarramento", utilizada principalmente pelo jogador.
+/// Esta ação direcionada tentará andar para o destino, se houver um
+/// ator no caminho, uma ação de ataque é gerada no lugar.
+/// </summary>
public partial class BumpAction : DirectionalAction
{
public BumpAction(Actor actor, Vector2I offset) : base(actor, offset)
@@ -11,14 +15,18 @@ public partial class BumpAction : DirectionalAction
{
Vector2I destination = actor.GridPosition + Offset;
+ // Declaramos uma ação genérica.
Action action;
+ // Se houver um ator no destino, crie uma ação de ataque.
if (GetBlockingActorAtPosition(destination) != null) {
action = new MeleeAction(actor, Offset);
} else {
+ // Mas se não houver, crie uma ação de movimento.
action = new MovementAction(actor, Offset);
}
+ // Executa a ação.
action.Perform();
}
}