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

public class GameOver : MonoBehaviour {


    public GameObject InGamePanel;
    public GameObject GameOverPanel;

    void Start()
    {
        GameStateController.Instance.GameStateChanged += Instance_GameStateChanged;
    }

    void Instance_GameStateChanged(EGameState oldState, EGameState newState)
    {
        if (newState == EGameState.GameOver)
        {
            InGamePanel.SetActive(false);
            GameOverPanel.SetActive(true);
        }
        else
        {
            InGamePanel.SetActive(true);
            GameOverPanel.SetActive(false);
        }
    }


    public void Quit()
    {
#if UNITY_STANDALONE
        Application.Quit();
#elif UNITY_UNITY_WEBPLAYER
		Application.LoadLevel(0);	// back to title
#endif
    }

    public void Restart()
    {
        Application.LoadLevel(Application.loadedLevel);
    }




}
