diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-10 12:34:20 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-10 12:34:37 -0300 |
| commit | b8962990ddb75b874a49c83d8eeaba7b7e45c196 (patch) | |
| tree | 68124e2d5b87f17c6f778e8088a148745621feb9 /scripts/Entities/Actors | |
| parent | c6bbb834f7758027c0df338f1520f34fad3befea (diff) | |
Centralização da lógica de distância.
Diffstat (limited to 'scripts/Entities/Actors')
| -rw-r--r-- | scripts/Entities/Actors/AI/HostileEnemyAI.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/Entities/Actors/AI/HostileEnemyAI.cs b/scripts/Entities/Actors/AI/HostileEnemyAI.cs index dbcf98d..2f925c1 100644 --- a/scripts/Entities/Actors/AI/HostileEnemyAI.cs +++ b/scripts/Entities/Actors/AI/HostileEnemyAI.cs @@ -1,5 +1,6 @@ using Godot; using TheLegendOfGustav.Entities.Actions; +using TheLegendOfGustav.Utils; namespace TheLegendOfGustav.Entities.Actors.AI; @@ -21,7 +22,7 @@ public partial class HostileEnemyAI : BaseAI Vector2I offset = target.GridPosition - Body.GridPosition; // Distância entre o inimigo e o jogador. Leva em consideração somente // um dos eixos. - int distance = int.Max(int.Abs(offset.X), int.Abs(offset.Y)); + int distance = Grid.Distance(Body.GridPosition, target.GridPosition); // A ação executada no turno pode ser de ataque ou de movimento. Action action; |
