去除max动画,用特效替代大招

This commit is contained in:
2024-11-16 16:47:17 +08:00
parent 0793334379
commit f41ff64395
6 changed files with 20 additions and 31 deletions

View File

@@ -19,7 +19,6 @@ export class HeroSpine extends Component {
animator: Animation = null!;
idle_clip: AnimationClip = null!;
atk_clip: AnimationClip = null!;
max_clip: AnimationClip = null!;
move_clip: AnimationClip = null!;
default_clip:string = "";
@@ -29,8 +28,7 @@ export class HeroSpine extends Component {
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
this.idle_clip = this.animator.clips[0];
this.atk_clip = this.animator.clips[1];
this.max_clip = this.animator.clips[2];
this.move_clip = this.animator.clips[3];
this.move_clip = this.animator.clips[2];
this.default_clip=this.move_clip.name;
let animation = this.animator.getComponent(Animation);
animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
@@ -46,7 +44,6 @@ export class HeroSpine extends Component {
}
in_playing(){
if(this.animator.getState(this.atk_clip.name).isPlaying) return true;
if(this.animator.getState(this.max_clip.name).isPlaying) return true;
if(this.animator.getState(this.idle_clip.name).isPlaying) return true;
if(this.animator.getState(this.move_clip.name).isPlaying) return true;
return false;
@@ -54,8 +51,7 @@ export class HeroSpine extends Component {
onAnimationEvent(type: Animation.EventType, state: AnimationState){
if(type==Animation.EventType.FINISHED){
// console.log("animator end",state.name);
if(state.name==this.atk_clip.name||state.name==this.max_clip.name){
// console.log("animator no atk and no max");
if(state.name==this.atk_clip.name){
this.default();
}
}
@@ -83,11 +79,7 @@ export class HeroSpine extends Component {
}
max(){
// console.log("do max");
this.animator.play(this.max_clip.name);
}
move(){
if(!this.animator.getState(this.move_clip.name).isPlaying) {
console.log("doing move");