技能改spine 怪物增加
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
import { _decorator, Animation, Component, Node } from 'cc';
|
||||
import { _decorator, Animation, Component, Node, sp } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('EndAnmCom')
|
||||
export class EndAnmCom extends Component {
|
||||
start() {
|
||||
start() {
|
||||
let anim = this.node.getComponent(Animation);
|
||||
console.log("动画",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
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("动画播放完毕")
|
||||
|
||||
Reference in New Issue
Block a user