using System;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Video;
using Button = UnityEngine.UI.Button;

public class PassManager : MonoBehaviour
{
    [SerializeField] private Button passButton;

    public event EventHandler PassRequested;
    
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        passButton.onClick.AddListener(OnPassClicked);
        GameManager.StateChanged += HandleStateChange;
    }

    private void HandleStateChange(GameState state) {
        if (state == GameState.RollDice)
        {
            passButton.interactable = false;
        }
        else
        {
            passButton.interactable = true;
        }
    }

    private void OnPassClicked()
    {
        PassRequested?.Invoke(this, EventArgs.Empty);
    }
}
