refactor(hero): 优化英雄动画状态同步逻辑
移除测试用的英雄成长模拟数据,修复动画状态与实际表现不一致的问题 1. 重构HeroSpine的idle/move方法,新增返回值标记动画是否被拦截 2. 重构HeroViewComp的status_change逻辑,仅在动画切换成功时更新状态 3. 重构HeroAnmComp的动画播放逻辑,修复动画结束后默认播放的异常 4. 移除SingletonModuleComp中的测试用英雄成长数据 5. 简化MoveSystem中状态切换的冗余判断逻辑
This commit is contained in:
@@ -35,11 +35,15 @@ export class HeroSpine extends Component {
|
||||
|
||||
|
||||
}
|
||||
idle(){
|
||||
|
||||
if(this.status=="idle") return
|
||||
/**
|
||||
* 播放待机动画:动画层成功切换才记录 status,
|
||||
* 被普攻/buff/大招拦截时返回 false 且不记录,保证记录与实际动画一致。
|
||||
*/
|
||||
idle(): boolean {
|
||||
if(this.status=="idle") return true
|
||||
if(!this.anm.idle()) return false
|
||||
this.status="idle"
|
||||
this.anm.idle()
|
||||
return true
|
||||
}
|
||||
atk() {
|
||||
this.anm.atk()
|
||||
@@ -75,10 +79,12 @@ export class HeroSpine extends Component {
|
||||
buff(){
|
||||
this.anm.buff()
|
||||
}
|
||||
move(){
|
||||
if(this.status=="move") return
|
||||
/** 播放移动动画(返回值语义与 idle() 一致:拦截时不记录状态) */
|
||||
move(): boolean {
|
||||
if(this.status=="move") return true
|
||||
if(!this.anm.move()) return false
|
||||
this.status="move"
|
||||
this.anm.move()
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user