using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class OnGameStateChanged : MonoBehaviour
{
    [SerializeField] private GameEventListener_Int onCurrentGameStateChanged;
    [Header("Settings:")]
    [SerializeField] private GameState validState;

    [Space(40f)]
    public UnityEvent onValidStateActive = new UnityEvent();
    public UnityEvent onInvalidStateActive = new UnityEvent();

    private void Awake()
    {
        onCurrentGameStateChanged.Response.AddListener((newState) =>
        {
            if ((GameState)newState == validState)
                onValidStateActive.Invoke();
            else
                onInvalidStateActive.Invoke();
        });
    }
}
