Exemplo n.º 1
0
 public void SubscribeToNotifier(UINotifier notifier)
 {
     if (!notifier.IsSubscribed)
     {
         notifier.notify += OnNotification;
         notifiers.Add(notifier);
         notifier.IsSubscribed = true;
     }
 }
Exemplo n.º 2
0
 public void UnsubscribeToNotifier(UINotifier notifier)
 {
     if (notifier.IsSubscribed)
     {
         notifier.notify -= OnNotification;
         notifiers.Remove(notifier);
         notifier.IsSubscribed = false;
     }
 }
Exemplo n.º 3
0
 void OnDestroy()
 {
     UINotifier[] notifiersCpy = new UINotifier[notifiers.Count];
     notifiers.CopyTo(notifiersCpy);
     foreach (UINotifier notifier in notifiersCpy)
     {
         UnsubscribeToNotifier(notifier);
     }
 }