コード例 #1
0
 /// <summary>
 /// Subscribes a listener to the components's events.
 /// Returns false if the listener was already subscribed.
 /// </summary>
 /// <param name="listener">The listener to subscribe</param>
 /// <returns>If the listener was successfully subscribed</returns>
 public bool AddListener(JumpMushroomListener listener)
 {
     if (_listeners.Contains(listener))
         return false;
     _listeners.Add(listener);
     return true;
 }
コード例 #2
0
 /// <summary>
 /// Unsubscribes a listener to the components's events.
 /// Returns false if the listener wasn't subscribed yet.
 /// </summary>
 /// <param name="listener">The listener to unsubscribe</param>
 /// <returns>If the listener was successfully unsubscribed</returns>
 public bool RemoveListener(JumpMushroomListener listener)
 {
     if (!_listeners.Contains(listener))
         return false;
     _listeners.Remove(listener);
     return true;
 }