using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GlobalManager : MonoBehaviour {

    public int score;

    public GameObject gameOverText;

    float frozenTime;

	// Use this for initialization
	void Start () {
        score = 0;
        frozenTime = 0;
	}

    public bool frozen
    {
        get { return frozenTime > 0; }
    }

    public void Freeze(float time)
    {
        frozenTime = time;
    }

    void Update()
    {
        if (frozenTime > 0)
            frozenTime -= Time.deltaTime;
    }

    public void EndGame()
    {
        gameOverText.SetActive(true);

        ItemWindow[] windows = GameObject.FindObjectsOfType<ItemWindow>();
        foreach (ItemWindow window in windows)
            GameObject.Destroy(window.gameObject);
    }

    public void Reload()
    {
        Time.timeScale = 1;
        SceneManager.LoadScene("main");
    }

    public void Exit()
    {
        Application.Quit();
    }
}
