Initial work on implementing Pokemon
This commit is contained in:
21
PkmnLib.Dynamic/Events/Handling/EventHook.cs
Normal file
21
PkmnLib.Dynamic/Events/Handling/EventHook.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user