import { _decorator, Component, Prefab, instantiate, Vec3, Node } from 'cc'; import { FlyCurrency } from './FlyCurrency'; import { UILayer } from '../../module/ui/UIManager'; const { ccclass, property } = _decorator; /** * 飞道具管理器 * */ @ccclass('CurrencyManager') export class CurrencyManager extends Component { @property currencyCount: number = 15; private flyNode: Node = null; /**设置飞道具的父节点 */ setFlyNode(node: Node) { this.flyNode = node; } public playFlyAnimation(startPos: Vec3, endPos: Vec3, parent: Node = null, count = 0) { let c = count > 0 ? count : this.currencyCount; for (let i = 0; i < c; i++) { const currency = instantiate(this.flyNode!); if (parent) parent.addChild(currency) else gg.ui.showNode(currency, UILayer.Anim); currency.getComponent(FlyCurrency)!.init(startPos, endPos); } } }