You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
495 B

  1. using System;
  2. public static class GameEvents
  3. {
  4. public static void Subscribe<T>(Action<T> callback) where T : class
  5. {
  6. GameEvents._dispatcher.Subscribe<T>(callback);
  7. }
  8. public static void Unsubscribe<T>(Action<T> callback) where T : class
  9. {
  10. GameEvents._dispatcher.Unsubscribe<T>(callback);
  11. }
  12. public static void Invoke<T>(T evt) where T : class
  13. {
  14. GameEvents._dispatcher.Invoke<T>(evt);
  15. }
  16. private static EventDispatcher _dispatcher = new EventDispatcher();
  17. }