using UnityEngine;

public class Subscriber : MonoBehaviour
{
    public GameEvent onButtonPressGameEvent;
    public IntGameEvent onButtonPressIntEvent;

    // We want to register our functions when this game object is enabled
    private void OnEnable()
    {
        onButtonPressGameEvent.RegisterListener(LogEventWithNoArguments);
        onButtonPressIntEvent.RegisterListener(LogEventWithIntArgument);
    }

    // We want to stop registering our functions when this game object is disabled
    private void OnDisable()
    {
        onButtonPressGameEvent.UnregisterListener(LogEventWithNoArguments);
        onButtonPressIntEvent.UnregisterListener(LogEventWithIntArgument);
    }

    public void LogEventWithNoArguments()
    {
        Debug.Log("eventWithNoArguments has been invoked");
    }

    public void LogEventWithIntArgument(int number)
    {
        Debug.Log($"eventWithIntArgument has been invoked with value {number}");
    }
}
