怪物攻击后不走路问题

This commit is contained in:
2025-07-21 14:49:13 +08:00
parent 163e8273c5
commit 2d6e8de164

View File

@@ -18,23 +18,23 @@ export default class HeroAnmComp extends Component{
this.is_spine=true
this.spine=this.getComponent('sp.Skeleton') as sp.Skeleton;
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
if(this.node.parent.getComponent(HeroViewComp).fac==1){
console.log('hero parent',this.node.parent.getComponent(HeroViewComp))
this._setMix('Walking', 'Idle');
this._setMix('Walking', 'Attacking');
this._setMix('Walking', 'Taunt');
this._setMix('Idle', 'Attacking');
this._setMix('Idle', 'Taunt');
this._setMix('Idle', 'Walking');
this._setMix('Attacking', 'Idle');
this._setMix('Attacking', 'Walking');
this._setMix('Taunt', 'Walking');
this._setMix('Taunt', 'Idle');
}
// if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
// console.log('hero parent',this.node.parent.getComponent(HeroViewComp))
// this._setMix('Walking', 'Idle');
// this._setMix('Walking', 'Attacking');
// this._setMix('Walking', 'Taunt');
// this._setMix('Idle', 'Attacking');
// this._setMix('Idle', 'Taunt');
// this._setMix('Idle', 'Walking');
// this._setMix('Attacking', 'Idle');
// this._setMix('Attacking', 'Walking');
// this._setMix('Taunt', 'Walking');
// this._setMix('Taunt', 'Idle');
// }
spine.setCompleteListener((trackEntry) => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
this.spine!.clearTrack(1);
this.idle()
}
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
@@ -106,21 +106,21 @@ export default class HeroAnmComp extends Component{
if(!this.is_spine) {
this.anm?.play('atk')
}else{
this.spine?.setAnimation(1, 'Attacking', false);
this.spine?.setAnimation(0, 'Attacking', false);
}
}
max () {
if(!this.is_spine) {
this.anm?.play('atk')
}else{
this.spine?.setAnimation(1, 'Taunt', false);
this.spine?.setAnimation(0, 'Taunt', false);
}
}
atked () {
if(!this.is_spine) {
this.anm?.play('move')
}else{
this.spine?.setAnimation(1, 'Hurt', false);
this.spine?.setAnimation(0, 'Hurt', false);
}
}
idle () {
@@ -131,7 +131,7 @@ export default class HeroAnmComp extends Component{
if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
this.spine?.setAnimation(0, 'Idle', true);
}else{
this.spine?.setAnimation(0, 'move', true);
this.spine?.setAnimation(0, 'Walking', true);
}
}
}