/// <summary> /// Subscribes a listener to the animation'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(EnemyBehaviourListener listener) { if (listeners.Contains(listener)) return false; listeners.Add(listener); return true; }
/// <summary> /// Unsubscribes a listener to the animation'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(EnemyBehaviourListener listener) { if (!listeners.Contains(listener)) return false; listeners.Remove(listener); return true; }