コード例 #1
0
 /// <summary>
 /// Subscribes a listener to the shoot'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(CharacterShootListener listener)
 {
     if (_listeners.Contains(listener))
         return false;
     _listeners.Add(listener);
     return true;
 }
コード例 #2
0
 /// <summary>
 /// Unsubscribes a listener to the shoot'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(CharacterShootListener listener)
 {
     if (!_listeners.Contains(listener))
         return false;
     _listeners.Remove(listener);
     return true;
 }