using System; using System.Collections.Generic; using UnityEngine; namespace UnityAtoms { public abstract class GameEvent : ScriptableObject { public event Action OnEvent; public void Raise(T item) { OnEvent?.Invoke(item); } public void RegisterListener(IGameEventListener listener) { OnEvent += listener.OnEventRaised; } public void UnregisterListener(IGameEventListener listener) { OnEvent -= listener.OnEventRaised; } } public abstract class GameEvent : ScriptableObject { public event Action OnEvent; public void Raise(T1 item1, T2 item2) { OnEvent?.Invoke(item1, item2); } public void RegisterListener(IGameEventListener listener) { OnEvent += listener.OnEventRaised; } public void UnregisterListener(IGameEventListener listener) { OnEvent -= listener.OnEventRaised; } } }