From b8962990ddb75b874a49c83d8eeaba7b7e45c196 Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 10 Sep 2025 12:34:20 -0300 Subject: Centralização da lógica de distância. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Entities/Actors/AI/HostileEnemyAI.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/Entities/Actors') 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; -- cgit v1.2.3