fix(技能动画): 修复技能"光箭"的动画触发和播放冲突
- 将技能配置中的动作类型从"atk"改为"max",以匹配英雄动画组件的逻辑 - 在动画组件中添加通用的`play`方法,并统一检查"max0"和"max1"动画的播放状态 - 防止多个动画同时播放导致的冲突问题
This commit is contained in:
@@ -42,22 +42,28 @@ export default class HeroAnmComp extends Component{
|
||||
this.default_anim='move'
|
||||
}
|
||||
atk () {
|
||||
if(this.anmcon.getState("max0").isPlaying) return
|
||||
if(this.anmcon.getState("max0").isPlaying||this.anmcon.getState("max1").isPlaying) return
|
||||
const atkName = `atk${this._atkIndex}`
|
||||
this.anmcon.play(atkName)
|
||||
this._atkIndex = (this._atkIndex + 1) % 3
|
||||
}
|
||||
max () {
|
||||
if(this.anmcon.getState("max0").isPlaying) return
|
||||
if(this.anmcon.getState("max0").isPlaying||this.anmcon.getState("max1").isPlaying) return
|
||||
this.anmcon.play("max0")
|
||||
}
|
||||
play(anm:string=""){
|
||||
if(anm==="") return
|
||||
if(this.anmcon.getState("max0").isPlaying||this.anmcon.getState("max1").isPlaying) return
|
||||
this.anmcon.play(anm)
|
||||
}
|
||||
|
||||
idle () {
|
||||
if(this.anmcon.getState("idle").isPlaying) return
|
||||
this.anmcon.play("idle")
|
||||
this.default_anim='idle'
|
||||
}
|
||||
buff(){
|
||||
if(this.anmcon.getState("max0").isPlaying) return
|
||||
if(this.anmcon.getState("max0").isPlaying||this.anmcon.getState("max1").isPlaying) return
|
||||
this.anmcon.play("buff")
|
||||
}
|
||||
dead(){
|
||||
|
||||
Reference in New Issue
Block a user