40 lines
777 B
TypeScript
Raw Normal View History

2023-11-17 18:29:39 +08:00
import { tween } from 'cc';
import { v3 } from 'cc';
import { Label } from 'cc';
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('ModeRenderHitText')
export class ModeRenderHitText extends Component {
@property(Label)
hitLabel:Label;
setText(hit:number){
this.hitLabel.string = `${hit}`;
this.setAnimation();
}
//设置动画
setAnimation(){
this.node.scale = v3(0,0,0);
tween(this.node)
.to(.5,{position:this.node.position.clone().add(v3(0,100,0)),scale:v3(1,1,1)},{
onComplete:() => {
this.node.destroy();
},
easing:"quadInOut"
})
.start();
}
}