public override bool ShouldTransition() { beforeShouldTransition?.Invoke(transition); bool shouldTransition = transition.ShouldTransition(); afterShouldTransition?.Invoke(transition); return(shouldTransition); }
/// <summary> /// Checks if a transition can take place, and if this is the case, transition to the /// "to" state and return true. Otherwise it returns false /// </summary> /// <param name="transition"></param> /// <returns></returns> private bool TryTransition(TransitionBase transition) { if (!transition.ShouldTransition()) { return(false); } RequestStateChange(transition.to, transition.forceInstantly); return(true); }