using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class SuccessfulStintsUI : MonoBehaviour 
{
    public Text UI_SuccessfulStints;
    public LevelManager levelManager;

    void OnAwake() 
    {
        UI_SuccessfulStints = GetComponent<Text>();
    }

    void OnEnable() 
    {
        UI_SuccessfulStints = GetComponent<Text>();
        EventManager.StartListening(Constants.GAME_OVER, UpdateText);
    }

    void OnDisable() 
    {
        EventManager.StopListening(Constants.GAME_OVER, UpdateText);
    }

    void UpdateText() 
    {
        UI_SuccessfulStints.text = levelManager.successfulStints.ToString();
    }
}
