fix(英雄): 调整近战最小攻击距离并修复攻击动画循环

- 将 meleeMinEnemyDistanceX 从 80 减少到 60,优化近战英雄攻击距离判定
- 在 HeroAnmComp 中添加 _atkIndex 变量,实现 atk0、atk1、atk2 攻击动画的循环播放
This commit is contained in:
panw
2026-03-19 09:43:53 +08:00
parent 2d0e5e3ed6
commit 8302515cf1
2 changed files with 6 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ export default class HeroAnmComp extends Component{
fsSprite:FlashSprite = null!; fsSprite:FlashSprite = null!;
private anmcon:any=null private anmcon:any=null
private _hasStop = true; private _hasStop = true;
private _atkIndex = 0;
private default_anim:string='Idle' private default_anim:string='Idle'
anms:any[]=["idle","move","stun","dead","buff","atk0","atk1","atk2","max0","max1"] anms:any[]=["idle","move","stun","dead","buff","atk0","atk1","atk2","max0","max1"]
onLoad () { onLoad () {
@@ -42,8 +43,9 @@ export default class HeroAnmComp extends Component{
} }
atk () { atk () {
if(this.anmcon.getState("max0").isPlaying) return if(this.anmcon.getState("max0").isPlaying) return
// if(this.anmcon.getState("atk0").isPlaying) return const atkName = `atk${this._atkIndex}`
this.anmcon.play("atk0") this.anmcon.play(atkName)
this._atkIndex = (this._atkIndex + 1) % 3
} }
max () { max () {
if(this.anmcon.getState("max0").isPlaying) return if(this.anmcon.getState("max0").isPlaying) return

View File

@@ -37,7 +37,7 @@ interface MoveFacConfig {
@ecs.register('MoveSystem') @ecs.register('MoveSystem')
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate { export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
private readonly meleeAttackRange = HeroDisVal[HType.Melee]; private readonly meleeAttackRange = HeroDisVal[HType.Melee];
private readonly meleeMinEnemyDistanceX = 80; private readonly meleeMinEnemyDistanceX = 60;
private readonly meleeOvertakeSpeedGap = 20; private readonly meleeOvertakeSpeedGap = 20;
private readonly allySpacingX = 40; private readonly allySpacingX = 40;
private readonly allyOverlapSpacingX = 14; private readonly allyOverlapSpacingX = 14;