Exemplo n.º 1
0
            public override bool ShouldTransition()
            {
                beforeShouldTransition?.Invoke(transition);
                bool shouldTransition = transition.ShouldTransition();

                afterShouldTransition?.Invoke(transition);
                return(shouldTransition);
            }
Exemplo n.º 2
0
        /// <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);
        }