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

public class GameEventListener : MonoBehaviour
{
    // The game event instance to register to.
    public EventResponses[] gameEvents;
    // The unity event response created for the event.

    private void OnEnable()
    {
        foreach (EventResponses eventResponse in gameEvents)
        {
            eventResponse.gameEvent.RegisterListener(eventResponse.Response);
        }
    }

    private void OnDisable()
    {
        foreach (EventResponses eventResponse in gameEvents)
        {
            eventResponse.gameEvent.UnregisterListener(eventResponse.Response);
        }
    }
}
[System.Serializable]
public struct EventResponses
{
    public GameEvent gameEvent;
    public UnityEvent Response;
}