using TMPro;
using UnityEngine;

namespace Views {
    public class ScoreView : MonoBehaviour {
        private TextMeshProUGUI scoreText;
        private float displayScore;
        private int actualScore;
        
        private void Awake() {
            this.scoreText = GetComponentInChildren<TextMeshProUGUI>();
        }

        public void UpdateScore(float scoreSpeed) {
            this.displayScore = Mathf.Lerp(this.displayScore, this.actualScore, scoreSpeed * Time.deltaTime);
            this.scoreText.text = this.displayScore.ToString("0");
        }

        public void SetScore(int score) {
            this.actualScore = score;
        }
    }
}