
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class GameManager : MonoBehaviour {

    private float elapsedTime = 120f;
    private Text textUI;
    private Text shadowTextUI;

    // Use this for initialization
    void Start () {
        textUI = GameObject.Find("TimerText").GetComponent<Text>();
        shadowTextUI = GameObject.Find("ShadowText").GetComponent<Text>();
    }

    // Update is called once per frame
    void Update () {
        /*if (sceneStarting)
        {
            FadeToClear();
            if (guiTextre.color.a <= 0.05f)
            {
                guiTextre.color = Color.clear;
                guiTextre.enabled = false;
                sceneStarting = false;
            }
        }*/
        
        if(elapsedTime <= 1f)
        {
            SceneManager.LoadSceneAsync("ResultScreen");
        } else
        {
            elapsedTime -= Time.deltaTime;
            textUI.text = Mathf.Floor(elapsedTime).ToString();
            shadowTextUI.text = Mathf.Floor(elapsedTime).ToString();
        }
    }
}
