21 lines
605 B
C#
21 lines
605 B
C#
|
namespace PkmnLib.Dynamic.Events;
|
||
|
|
||
|
/// <summary>
|
||
|
/// The event hook of a battle. This is used to hook into the battle and get notified when something
|
||
|
/// happens that a front-end might want to know about.
|
||
|
/// </summary>
|
||
|
public class EventHook
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// The event handler that is called when the event is triggered.
|
||
|
/// </summary>
|
||
|
public event EventHandler<IEventData>? Handler;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Triggers the event, calling the handler with the given data.
|
||
|
/// </summary>
|
||
|
public void Invoke(IEventData data)
|
||
|
{
|
||
|
Handler?.Invoke(this, data);
|
||
|
}
|
||
|
}
|