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

public class GameManager : MonoBehaviour
{
    public GameObject[] cannons;
    public TextMeshProUGUI message;

    private void Awake()
    {
        message.gameObject.SetActive(false);
    }
    // Start is called before the first frame update
    void Start()
    {
        //message.gameObject.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {
        if (cannons[0] == null || cannons[1] == null)
        {
            GameOver();
        }
    }

    public void GameOver()
    {
        message.gameObject.SetActive(true);
        Invoke("Restart", 5f);
    }

    public void Restart()
    {
        SceneManager.LoadScene(0);
    }
}
