From 8667656e486c352779143a9f6746baaa46298f63 Mon Sep 17 00:00:00 2001 From: panw Date: Tue, 17 Mar 2026 14:57:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=80=BB=E8=BE=91=E4=B8=AD=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将原条件 `dist < minRange` 改为 `dist >= minRange`,并与阵型移动需求结合。原逻辑在距离过近时也会触发移动,导致英雄可能无法保持在有效攻击范围内。新逻辑确保仅在距离足够且需要调整阵型位置时才移动。 --- assets/script/game/hero/MoveComp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/script/game/hero/MoveComp.ts b/assets/script/game/hero/MoveComp.ts index 8ca2331b..ae917fbb 100644 --- a/assets/script/game/hero/MoveComp.ts +++ b/assets/script/game/hero/MoveComp.ts @@ -198,8 +198,8 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate const [minRange, maxRange] = this.resolveCombatRange(model, defaultMin, defaultMax); const dist = Math.abs(currentX - enemyX); const needMoveToFormation = Math.abs(currentX - targetX) > 5; - const shouldKeepDistance = dist < minRange; - if (needMoveToFormation || shouldKeepDistance) { + + if (dist >= minRange && needMoveToFormation) { const dir = targetX > currentX ? 1 : -1; move.direction = dir; const speed = model.speed / 3;