Skip to content

Commit

Permalink
Add 2 examples to EventManager.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
valkyrienyanko committed Mar 12, 2023
1 parent a373b9f commit 7550ace
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Scripts/Static/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@ namespace Sankari;

/// <summary>
/// This class was created to attempt to simplify the process of creating C# for gamedev.
///
/// ########### Example #1 ###########
///
/// Events.Generic.AddListener(EventGeneric.OnKeyboardInput, (args) =>
/// {
/// GD.Print(args[0]);
/// GD.Print(args[1]);
/// GD.Print(args[2]);
/// }, "someId");
///
/// Events.Generic.RemoveListeners(EventGeneric.OnKeyboardInput, "someId");
///
/// // Listener is never called because it was removed
/// Events.Generic.Notify(EventGeneric.OnKeyboardInput, 1, 2, 3);
///
/// ########### Example #2 ###########
/// Events.Player.AddListener<PlayerSpawnArgs>(EventPlayer.OnPlayerSpawn, (args) =>
/// {
/// GD.Print(args.Name);
/// GD.Print(args.Location);
/// GD.Print(args.Player);
/// });
///
/// Events.Player.Notify(EventPlayer.OnPlayerSpawn, new PlayerSpawnArgs(name, location, player));
/// </summary>
/// <typeparam name="TEvent">The event type enum to be used. For example 'EventPlayer' enum.</typeparam>
public class EventManager<TEvent>
Expand Down

0 comments on commit 7550ace

Please sign in to comment.