Files
heros/assets/script/game/skills/EndAnmCom.ts
2025-01-12 23:58:35 +08:00

33 lines
1023 B
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() {
let anim = this.node.getComponent(Animation);
if(anim){
console.log("has anim",anim)
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
}
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
if(spine){
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) {
}
}