mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 08:36:14 +00:00
Added timer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, ProgressBar, _decorator } from "cc";
|
||||
import { Component, Label, ProgressBar, _decorator } from "cc";
|
||||
import { Player } from "../Unit/Player/Player";
|
||||
import { UnitLevel } from "../Unit/UnitLevel";
|
||||
|
||||
@@ -7,6 +7,7 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass("GameUI")
|
||||
export class GameUI extends Component {
|
||||
@property(ProgressBar) private xpBar: ProgressBar;
|
||||
@property(Label) private timeAliveText: Label;
|
||||
|
||||
private playerLevel: UnitLevel;
|
||||
|
||||
@@ -20,4 +21,8 @@ export class GameUI extends Component {
|
||||
private updateProgressBar(): void {
|
||||
this.xpBar.progress = this.playerLevel.XP / this.playerLevel.RequiredXP;
|
||||
}
|
||||
|
||||
public updateTimeAlive(timeAlive: number): void {
|
||||
this.timeAliveText.string = `${Math.floor(timeAlive)}`;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user