namespace GatherAndDefend.Events
{
///
/// lets you create custom events for the event aggregator
///
public abstract class EventBase
{
private event System.Action innerEvent;
public void Invoke()
{
innerEvent?.Invoke();
}
public void Attach(System.Action handler)
{
innerEvent += handler;
}
public void Detach(System.Action handler)
{
innerEvent -= handler;
}
}
///
/// lets you create custom event with given parameter for the event aggregator
///
///
public abstract class EventBase : EventBase
{
private event System.Action innerEvent;
public void Invoke(T value) => innerEvent?.Invoke(value);
public void Attach(System.Action handler) => innerEvent += handler;
public void Detach(System.Action handler) => innerEvent -= handler;
}
}