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

public class ButtonManager : MonoBehaviour {

    public Button btn_Retry;
    public Button btn_BackToMenu;

    public string GameSceneName;
    public string MainMenu;

    void Awake()
    {
        btn_Retry.gameObject.SetActive(false);
        btn_BackToMenu.gameObject.SetActive(false);
    }
    void OnEnable()
    {
        EventManager.StartListening(Constants.GAME_OVER, OnShowButtons);
    }
    void OnDisable()
    {
        EventManager.StopListening(Constants.GAME_OVER, OnShowButtons);
    }

    void OnShowButtons()
    {

        btn_Retry.gameObject.SetActive(true);
        btn_BackToMenu.gameObject.SetActive(true);
    }
    public void OnRetry()
    {
        EventManager.TriggerEvent(Constants.ButtonClick);
        Fading.Instance.StartFade(GameSceneName);
    }

    public void OnMenu()
    {
        EventManager.TriggerEvent(Constants.ButtonClick);
        Fading.Instance.StartFade(MainMenu);
    }

}
