怪物攻击后不走路问题

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