import { _decorator, Component, sp } from "cc"; const { ccclass, property } = _decorator; @ccclass export default class BombSpine extends Component { Sk: sp.Skeleton = null; protected onLoad(): void { this.Sk = this.node.getComponentInChildren(sp.Skeleton); } /**播放技能动画 */ public playSpine(name: string, callback: Function = null, timeScale = 1, loop = true) { if(!this.Sk) { this.Sk = this.node.getComponentInChildren(sp.Skeleton); } this.Sk.setCompleteListener(() => { this.Sk.setCompleteListener(null); if (callback) callback(); }); this.Sk.timeScale = timeScale * gg.game.CurentBattle.TimeScale; this.Sk.setAnimation(0, name, loop); } /**销毁节点 */ destoryNode(){ gg.res.putNode(this.node) } }