技能动画暂停
This commit is contained in:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user