using UnityEngine;
using System;

public class Publisher : MonoBehaviour
{
    public static event Action eventWithNoArguments;
    public static event Action<int> eventWithIntArgument;

    private void Update()
    {
        // When any key is pressed, invoke our events
        if (Input.anyKeyDown)
        {
            // We use the (?) to check to see if our event has subscribers.
            // If there are no subscribers we do not invoke the event. Otherwise we do invoke the event.
            eventWithNoArguments?.Invoke();
            eventWithIntArgument?.Invoke(42);
        }
    }
}
