using UnityEngine;
using UnityEngine.UI;
using UnityEngine.InputSystem;

public class ReloadPlayers : MonoBehaviour
{
    public int levelNumber;
    public PlayerInput playerInput;

    private Button button;
    private InputActionMap currentActionMap;

    private void Awake()
    {
        button = GetComponent<Button>();
        currentActionMap = playerInput.currentActionMap;
    }

    void Start()
    {
        currentActionMap.FindAction("Restart").started += _ => button.onClick.Invoke();
    }


    public void LoadPlayers()
    {
        levelChooser.ChooseLevel(levelNumber);
    }

}
