dd
This commit is contained in:
@@ -10,30 +10,35 @@ export default class HeroAnmComp extends Component{
|
||||
|
||||
private spine?: sp.Skeleton;
|
||||
private _hasStop = true;
|
||||
private default_anim:string='Idle'
|
||||
onLoad () {
|
||||
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
|
||||
this._setMix('Walking', 'Idle');
|
||||
this._setMix('Walking', 'Attacking');
|
||||
this._setMix('Walking', 'Taunt');
|
||||
this._setMix('Walking', 'Hurt');
|
||||
this._setMix('Idle', 'Attacking');
|
||||
this._setMix('Idle', 'Taunt');
|
||||
this._setMix('Idle', 'Walking');
|
||||
this._setMix('Idle', 'Hurt');
|
||||
this._setMix('Attacking', 'Idle');
|
||||
this._setMix('Attacking', 'Walking');
|
||||
this._setMix('Attacking', 'Hurt');
|
||||
this._setMix('Attacking', 'Taunt');
|
||||
this._setMix('Taunt', 'Walking');
|
||||
this._setMix('Taunt', 'Idle');
|
||||
this._setMix('Taunt', 'Attacking');
|
||||
this._setMix('Taunt', 'Hurt');
|
||||
this._setMix('Hurt', 'Idle');
|
||||
this._setMix('Hurt', 'Attacking');
|
||||
this._setMix('Hurt', 'Taunt');
|
||||
this._setMix('Hurt', 'Walking');
|
||||
|
||||
spine.setCompleteListener((trackEntry) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
|
||||
this.spine!.clearTrack(1);
|
||||
if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
|
||||
this.spine?.setAnimation(0, 'Idle', false);
|
||||
}
|
||||
this.spine?.setAnimation(0, this.default_anim, true);
|
||||
}
|
||||
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
|
||||
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
|
||||
@@ -85,6 +90,7 @@ export default class HeroAnmComp extends Component{
|
||||
this.spine?.setToSetupPose();
|
||||
}
|
||||
this.spine?.setAnimation(0, 'Walking', true);
|
||||
this.default_anim='Walking'
|
||||
this._hasStop = false;
|
||||
}
|
||||
atk () {
|
||||
@@ -100,6 +106,7 @@ export default class HeroAnmComp extends Component{
|
||||
idle () {
|
||||
this.spine?.setToSetupPose();
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
this.default_anim='Idle'
|
||||
}
|
||||
|
||||
_setMix (anim1: string, anim2: string) {
|
||||
|
||||
Reference in New Issue
Block a user