24 lines
665 B
C#
24 lines
665 B
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace Views {
|
|
public class ScoreView : MonoBehaviour {
|
|
private TextMeshProUGUI scoreText;
|
|
private float displayScore = 0;
|
|
private int actualScore = 0;
|
|
|
|
private void Awake() {
|
|
this.scoreText = GetComponentInChildren<TextMeshProUGUI>();
|
|
}
|
|
|
|
public void UpdateScore() {
|
|
this.displayScore = Mathf.Lerp(this.displayScore, this.actualScore, 5 * Time.deltaTime);
|
|
this.scoreText.text = this.displayScore.ToString("0");
|
|
}
|
|
|
|
public void SetScore(int score) {
|
|
this.actualScore = score;
|
|
}
|
|
}
|
|
} |