From 80359de181e78f6cc397e3cae996e4cf5ed76f3e Mon Sep 17 00:00:00 2001 From: panw Date: Fri, 20 Jun 2025 16:35:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=80=E8=83=BD=E5=8A=A8=E7=94=BB=E6=9A=82?= =?UTF-8?q?=E5=81=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/skills/SkillCom.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index 49251ce8..e45ba9fe 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -43,6 +43,8 @@ export class SkillCom extends CCComp { FIGHTCON:FightConComp=null; hited_time:number=0; hit_count:number=0; + spine:sp.Skeleton=null; + anim:Animation=null; private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向 protected onLoad(): void { @@ -51,7 +53,11 @@ export class SkillCom extends CCComp { } start() { - + if(this.node.getChildByName('anm')){ + this.spine=this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton; + }else{ + this.anim=this.node.getComponent(Animation) + } oops.message.on(GameEvent.MissionEnd, this.doDestroy, this); this.node.active = true; let collider = this.getComponent(Collider2D); @@ -94,9 +100,8 @@ export class SkillCom extends CCComp { } if(this.node.getChildByName('anm')){ if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){ - var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton; - console.log("has spine",spine) - spine.setCompleteListener((trackEntry) => { + console.log("has spine",this.spine) + this.spine.setCompleteListener((trackEntry) => { this.onAnimationFinishedToDestroy() console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex); }); @@ -170,7 +175,13 @@ export class SkillCom extends CCComp { update(deltaTime: number) { let config=SkillSet[this.s_uuid] - if(smc.mission.pause) return; + if(smc.mission.pause) { + if(this.spine) this.spine.paused=true + if(this.anim) this.anim.pause() + return; + } + if(this.anim) this.anim.resume() + if(this.spine) this.spine.paused=false if (!this.node || !this.node.isValid) return; this.hited_time+=deltaTime if(this.hited_time>config.hited&&this.AType==AType.fixedEnd&&this.hit_count == 0){