diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-04 16:18:17 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-04 16:18:17 -0300 |
| commit | 9953c9a5818baa392a48a4d18339c73f3b7a814e (patch) | |
| tree | 3484fbca78bfa217d84226cc774119fe054f6df9 /scripts/entities/actors/actions/DirectionalAction.cs | |
| parent | 7dbe2bbe431f77deb3515e5cf0810cfa07215d59 (diff) | |
Prepare
Diffstat (limited to 'scripts/entities/actors/actions/DirectionalAction.cs')
| -rw-r--r-- | scripts/entities/actors/actions/DirectionalAction.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/entities/actors/actions/DirectionalAction.cs b/scripts/entities/actors/actions/DirectionalAction.cs new file mode 100644 index 0000000..ca2ca95 --- /dev/null +++ b/scripts/entities/actors/actions/DirectionalAction.cs @@ -0,0 +1,30 @@ +using Godot; + +/// <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 +{ + /// <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; } + public DirectionalAction(Actor actor, Vector2I offset) : base(actor) + { + Offset = 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 Actor GetTargetActor() { + return Map_Data.GetBlockingActorAtPosition(Destination); + } +} |
