diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 6d5698ef..95c246d1 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -26,7 +26,7 @@ export const FormationPointX = { } as const; export const HeroDisVal: Record = { - [HType.Melee]: 150, + [HType.Melee]: 360, [HType.Mid]: 400, [HType.Long]: 720, } diff --git a/assets/script/game/hero/MoveComp.ts b/assets/script/game/hero/MoveComp.ts index 9c729b40..3aa74986 100644 --- a/assets/script/game/hero/MoveComp.ts +++ b/assets/script/game/hero/MoveComp.ts @@ -200,28 +200,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate } private processMeleeLogic(e: ecs.Entity, move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp) { - const currentX = view.node.position.x; - const enemyX = enemy.node.position.x; - const dist = Math.abs(currentX - enemyX); - const maxRange = this.meleeAttackRange; - const minRange = Math.min(this.meleeMinEnemyDistanceX, maxRange); - - /** 近战目标点 = 敌人位置 - 朝向 * minRange,确保能贴近但不穿模 */ - move.direction = enemyX > currentX ? 1 : -1; - move.targetX = enemyX - move.direction * minRange; - - if (dist <= minRange) { - view.status_change("idle"); - model.is_atking = true; - } else if (dist <= maxRange) { - const speed = model.speed / 3; - this.moveEntity(view, move.direction, speed, move.targetX); - model.is_atking = true; - } else { - const speed = model.speed / 3; - this.moveEntity(view, move.direction, speed); - model.is_atking = true; - } + this.processRangedFormationCombat(move, view, model); } private processMidLogic(e: ecs.Entity, move: MoveComp, view: HeroViewComp, model: HeroAttrsComp, enemy: HeroViewComp) {