| 123456789101112131415161718192021222324252627 |
- import { _decorator, Component, Node,Label } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('UpdateScore')
- export class UpdateScore extends Component {
- public static instance:UpdateScore=null;
- private totalScore:number=0;
- start() {
- UpdateScore.instance=this;
- this.node.getComponent(Label).string='0';
- }
- update(deltaTime: number) {
-
- }
- public Update_Score(score:number){
- this.totalScore+=score;
- this.node.getComponent(Label).string=this.totalScore.toString();
- }
- public getScore(){
- return this.totalScore;
- }
- }
|