/// <summary> /// This function calls the specific fast event to activate all its subscribed methods. /// Beware of fast events, since they do not check if their MonoBehaviour has been destroyed, /// the user must remove the method manually (using the RemoveMethod function). /// <param name = "eventAction">The dictionary key associated with the event</param> /// /// <param name = "objects">The parameters for invoke</param> /// </summary> public static void CallEvent(EventFastAction action, params System.Object[] objects) { dictionaryFastEvent[action]?.DynamicInvoke(objects); }
/// <summary> /// The function adds a fast action (method that returns void) with zero parameters to a specific event /// </summary> /// <param name = "eventAction">The delegate associated with the event</param> /// <param name = "action">The action</param> public static void AddMethod <T>(EventFastAction eventAction, T action) where T : Delegate { dictionaryFastEvent[eventAction] = Delegate.Combine(dictionaryFastEvent[eventAction], action); }
/// <summary> /// The function remove a fast action (method that returns void) with two parameters to a specific event /// </summary> /// <param name = "eventAction">The delegate associated with the event</param> /// <param name = "action">The action</param> public static void RemoveMethod <T>(EventFastAction eventAction, T action) where T : Delegate { dictionaryFastEvent[eventAction] = Delegate.Remove(dictionaryFastEvent[eventAction], action); }