import EffectManager from "./EffectManager";
|
|
const {ccclass, property} = cc._decorator;
|
|
@ccclass
|
export default class ScoreNum extends cc.Component {
|
|
label: cc.Label = null;
|
manager: EffectManager;
|
|
onLoad(){
|
this.label = this.getComponent(cc.Label);
|
}
|
|
show(num:number, pos: cc.Vec2){
|
this.label.string = num.toString();
|
this.node.scale = 0.01;
|
this.node.position = pos;
|
//this.node.opacity = 50;
|
this.node.runAction(
|
cc.sequence(
|
cc.scaleTo(0.4, 2).easing(cc.easeBackOut()),
|
cc.moveBy(0.4, cc.v2(0, 35)),
|
cc.fadeOut(0.1),
|
cc.callFunc(this.hide, this)
|
)
|
);
|
}
|
|
hide(){
|
this.node.active = false;
|
}
|
|
recycle(){
|
if (this.manager){
|
this.manager.recycleScoreNum(this);
|
}
|
}
|
|
reuse(manager: EffectManager){
|
this.manager = manager;
|
}
|
}
|