加血技能完成 怪物动画减少

This commit is contained in:
walkpan
2024-09-15 23:25:34 +08:00
parent 417b5d85be
commit 2095393757
317 changed files with 36222 additions and 60962 deletions

View File

@@ -17,9 +17,7 @@ const { ccclass, property } = _decorator;
export class MonSpine extends Component {
@property(Animation)
animator: Animation = null!;
idle_clip: AnimationClip = null!;
atk_clip: AnimationClip = null!;
max_clip: AnimationClip = null!;
move_clip: AnimationClip = null!;
default_clip:string = "move";
@@ -27,10 +25,8 @@ export class MonSpine extends Component {
// 角色控制组件
this.initAnimator();
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.atk_clip = this.animator.clips[0];
this.move_clip = this.animator.clips[1];
let animation = this.animator.getComponent(Animation);
animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
}
@@ -43,7 +39,7 @@ export class MonSpine extends Component {
onAnimationEvent(type: Animation.EventType, state: AnimationState){
if(type==Animation.EventType.FINISHED){
if(state.name==this.atk_clip.name||state.name==this.max_clip.name){
if(state.name==this.atk_clip.name){
this.default();
}
}
@@ -57,8 +53,8 @@ export class MonSpine extends Component {
}
}
idle(){
if(!this.animator.getState(this.idle_clip.name).isPlaying){
this.animator.play(this.idle_clip.name);
if(!this.animator.getState(this.move_clip.name).isPlaying){
this.animator.play(this.move_clip.name);
}
}
atk() {
@@ -69,8 +65,8 @@ export class MonSpine extends Component {
max(){
if(!this.animator.getState(this.max_clip.name).isPlaying){
this.animator.play(this.max_clip.name);
if(!this.animator.getState(this.atk_clip.name).isPlaying){
this.animator.play(this.atk_clip.name);
}
}