技能动画暂停
This commit is contained in:
@@ -43,6 +43,8 @@ export class SkillCom extends CCComp {
|
|||||||
FIGHTCON:FightConComp=null;
|
FIGHTCON:FightConComp=null;
|
||||||
hited_time:number=0;
|
hited_time:number=0;
|
||||||
hit_count:number=0;
|
hit_count:number=0;
|
||||||
|
spine:sp.Skeleton=null;
|
||||||
|
anim:Animation=null;
|
||||||
private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向
|
private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向
|
||||||
|
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
@@ -51,7 +53,11 @@ export class SkillCom extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
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);
|
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
|
||||||
this.node.active = true;
|
this.node.active = true;
|
||||||
let collider = this.getComponent(Collider2D);
|
let collider = this.getComponent(Collider2D);
|
||||||
@@ -94,9 +100,8 @@ export class SkillCom extends CCComp {
|
|||||||
}
|
}
|
||||||
if(this.node.getChildByName('anm')){
|
if(this.node.getChildByName('anm')){
|
||||||
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||||
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
|
console.log("has spine",this.spine)
|
||||||
console.log("has spine",spine)
|
this.spine.setCompleteListener((trackEntry) => {
|
||||||
spine.setCompleteListener((trackEntry) => {
|
|
||||||
this.onAnimationFinishedToDestroy()
|
this.onAnimationFinishedToDestroy()
|
||||||
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||||
});
|
});
|
||||||
@@ -170,7 +175,13 @@ export class SkillCom extends CCComp {
|
|||||||
|
|
||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
let config=SkillSet[this.s_uuid]
|
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;
|
if (!this.node || !this.node.isValid) return;
|
||||||
this.hited_time+=deltaTime
|
this.hited_time+=deltaTime
|
||||||
if(this.hited_time>config.hited&&this.AType==AType.fixedEnd&&this.hit_count == 0){
|
if(this.hited_time>config.hited&&this.AType==AType.fixedEnd&&this.hit_count == 0){
|
||||||
|
|||||||
Reference in New Issue
Block a user