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

public class Pause : MonoBehaviour
{

    public GameObject MenuPause;
    public GameObject TextPile;
    public int activePause = 0;

    private void Update() {
        if (activePause == 0) {
            if (Input.GetKeyDown(KeyCode.Escape)) {
                MenuPause.SetActive(true);
                Time.timeScale = 0;
                activePause = 1;
                TextPile.SetActive(false);
            }
        }
        else if (activePause == 1) {
             if (Input.GetKeyDown(KeyCode.Escape)) {
                MenuPause.SetActive(false);
                Time.timeScale = 1;
                activePause = 0;
                TextPile.SetActive(true);
            }
        }
      
    }


    public void Continue() {
        MenuPause.SetActive(false);
        activePause = 0;
    }

   public void ExitPause() {
        Time.timeScale = 1;
        SceneManager.LoadScene(0);
       
    }
    

}
