GameSrartEvent.cs 436 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class GameSrartEvent : MonoBehaviour
  6. {
  7. private static Action mOnEvent;
  8. public static void Register(Action onEvent)
  9. {
  10. mOnEvent += onEvent;
  11. }
  12. public static void UnRegister(Action onEvent)
  13. {
  14. mOnEvent -= onEvent;
  15. }
  16. public static void Trigger()
  17. {
  18. mOnEvent?.Invoke();
  19. }
  20. }