﻿using TMPro;
using UnityEngine;
using Yumon.Template.Lite.Internal;

namespace Yumon.Template.Lite
{
    [RequireComponent(typeof(TextMeshProUGUI))]
    public class GameOverScoreText : MonoBehaviour
    {
        TextMeshProUGUI _text;

        void Awake()
        {
            _text = GetComponent<TextMeshProUGUI>();
            YumonGameManager.OnLevelEndWithScore += OnLevelEndWithScore;
        }
        
        void OnLevelEndWithScore(int score) => _text.text = $"Your score: {score}";
    }
}
