public static bool ProcessSingleMessage( CurrentMessageInformation currentMessageInformation, Func<CurrentMessageInformation, bool> messageRecieved) { if (messageRecieved == null) return false; foreach (Func<CurrentMessageInformation, bool> func in messageRecieved.GetInvocationList()) { if (func(currentMessageInformation)) { return true; } } return false; }
/// <summary> /// Check each of the booleans in a BoolAction. If any of the returns are false, /// return false. If none of them are false, we can return true. /// </summary> /// <param name="actions">Event storage of methods.</param> private bool DoesBoolExist(Func<GameObject, bool> actions, GameObject g) { foreach(Func<GameObject, bool> bAction in actions.GetInvocationList()) { //If the return value of the action is ever false, return value must be false if (bAction(g) == false) { return false; } } return true; }