You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1002 B
36 lines
1002 B
|
1 week ago
|
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);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|