37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { _decorator, Animation, Component, Node, sp } from 'cc';
|
|
import { SkillCom } from './SkillCom';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('EndAnmCom')
|
|
export class EndAnmCom extends Component {
|
|
start() {
|
|
|
|
if(this.node.getComponent(Animation)){
|
|
let anim = this.node.getComponent(Animation);
|
|
console.log("has anim",anim)
|
|
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
|
}
|
|
|
|
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) => {
|
|
this.onAnimationFinished()
|
|
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
onAnimationFinished(){
|
|
console.log("动画播放完毕")
|
|
let bese = this.node.getComponent(SkillCom)
|
|
bese.is_destroy = true
|
|
}
|
|
update(deltaTime: number) {
|
|
|
|
}
|
|
}
|
|
|
|
|