PkmnLib.NET/PkmnLib.Dynamic/Events/Handling/EventHook.cs

21 lines
601 B
C#
Raw Normal View History

2024-07-27 14:26:45 +00:00
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;
2025-03-02 16:19:57 +00:00
2024-07-27 14:26:45 +00:00
/// <summary>
/// Triggers the event, calling the handler with the given data.
/// </summary>
public void Invoke(IEventData data)
{
Handler?.Invoke(this, data);
}
}