22 lines
522 B
C#
22 lines
522 B
C#
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class PlayerScore : MonoBehaviour
|
|
{
|
|
private TextMeshProUGUI scoreText;
|
|
private float internalScore;
|
|
private int currentScoreValue;
|
|
|
|
|
|
private void Awake()
|
|
{
|
|
scoreText = GetComponent<TextMeshProUGUI>();
|
|
}
|
|
void Update()
|
|
{
|
|
internalScore = Mathf.Lerp(internalScore, Player.Instance.score, 10f * Time.deltaTime);
|
|
currentScoreValue = Mathf.RoundToInt(internalScore);
|
|
scoreText.text = currentScoreValue.ToString();
|
|
}
|
|
}
|