summaryrefslogtreecommitdiff
path: root/scripts/Entities/Actions/DirectionalAction.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-09 19:09:34 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-09 19:09:34 -0300
commitc6bbb834f7758027c0df338f1520f34fad3befea (patch)
tree1818cd23c24be16fbe19b16dd0a510874d440d83 /scripts/Entities/Actions/DirectionalAction.cs
parentf1b51bed52ffbd90b5b7cc8dcfc6f0484bbbeb3c (diff)
Organização
Diffstat (limited to 'scripts/Entities/Actions/DirectionalAction.cs')
-rw-r--r--scripts/Entities/Actions/DirectionalAction.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/Entities/Actions/DirectionalAction.cs b/scripts/Entities/Actions/DirectionalAction.cs
new file mode 100644
index 0000000..e32e9f2
--- /dev/null
+++ b/scripts/Entities/Actions/DirectionalAction.cs
@@ -0,0 +1,37 @@
+using Godot;
+using TheLegendOfGustav.Entities.Actors;
+using TheLegendOfGustav.Map;
+
+namespace TheLegendOfGustav.Entities.Actions;
+
+/// <summary>
+/// Ação direcionada. Esta ação é acompanhada com um vetor que representa uma
+/// distância tendo como ponto de partida o ator.
+/// </summary>
+public abstract partial class DirectionalAction : Action
+{
+ public DirectionalAction(Actor actor, Vector2I offset) : base(actor)
+ {
+ Offset = offset;
+ }
+
+ /// <summary>
+ /// Direção/distância do ator da ação.
+ /// Seu significado depende da ação que implementará esta classe.
+ /// </summary>
+ public Vector2I Offset { get; private set; }
+
+ /// <summary>
+ /// Coordenada do alvo da ação.
+ /// </summary>
+ public Vector2I Destination { get => Actor.GridPosition + Offset; }
+
+ /// <summary>
+ /// Função que obtém o alvo da ação, se houver.
+ /// </summary>
+ /// <returns>O ator alvo da ação, nulo se não houver.</returns>
+ protected Entity GetTarget()
+ {
+ return MapData.GetBlockingEntityAtPosition(Destination);
+ }
+}