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

public class GameOver : MonoBehaviour
{
    public Button restartButton;
    public GameObject win;
    public GameObject gameOver;

    private void Awake()
    {
        win.SetActive(false);
        gameOver.SetActive(false);
    }

    private void Start()
    {
        Button btn = restartButton.GetComponent<Button>();
        btn.onClick.AddListener(ChangeScene);
    }
    private void Update()
    {
        if(PlayerPrefs.GetInt("GameOverStatus") == 1)
        {
            win.SetActive(true);
        }
        else if(PlayerPrefs.GetInt("GameOverStatus") == 0)
        {
            gameOver.SetActive(true);
        }
    }
    private void ChangeScene()
    {
        SceneManager.LoadScene(0);
    }
}
