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

public class EscMenu : MonoBehaviour
{
    private InputControls inputControls;
    private InputActionMap currentActionMap;

    public GameObject canvas;
    public GameObject pauseOverlay;

    // Start is called before the first frame update
    private void Awake()
    {
        inputControls = new InputControls();
        PlayerInput playerInput = GetComponent<PlayerInput>();
        currentActionMap = playerInput.currentActionMap;
    }

    void Start()
    {
        currentActionMap.FindAction("Cancel").started += _ => Pause();
    }

    void Pause() 
    {
        canvas.SetActive(true);
        pauseOverlay.SetActive(true);
    }
}
