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

public class GameManager : MonoBehaviour
{
    private ObjectCheck[] snaps;

    //public Text timerText;

    // Start is called before the first frame update
    void Start()
    {
        snaps = (ObjectCheck[])GameObject.FindObjectsOfType(typeof(ObjectCheck));
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene("menu");
        }
    }

    public void LoadMenu(string sceneName)
    {
        SceneManager.LoadScene(sceneName);
    }

    //IEnumerator ReloadTimer(float reloadTimeInSeconds)
    //{
    //    float counter = 0;

    //    while (counter < reloadTimeInSeconds)
    //    {
    //        counter += Time.deltaTime;
    //        timerText.text = counter.ToString();
    //        yield return null;
    //    }

    //    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    //}

    //public void CheckWin()
    //{
    //    if (Win() == true)
    //    {
    //        print("you win");
    //    }
    //    else
    //    {
    //        print("you lose");
    //    }
    //}

    //private bool Win()
    //{
    //    for (int i = 0; i < snaps.Length; i++)
    //    {
    //        if (snaps[i].correct == false)
    //        {
    //            return false;
    //        }
    //    }

    //    return true;
    //}
}
