public static void ForeachTransition <TState, TTrigger>(this IStateMachine <TState, TTrigger> fsm, ReturnTrueToFinishIteration <Transition <TState, TTrigger> > finishable)
        {
            Transition <TState, TTrigger>[] transitions = fsm.GetTransitions();

            foreach (Transition <TState, TTrigger> transition in transitions)
            {
                if (finishable(transition))
                {
                    return;
                }
            }
        }
        public static void ForeachInActiveHierarchyPath <TState, TTrigger>(this IHierarchicalStateMachine <TState, TTrigger> hsm, ReturnTrueToFinishIteration <KeyValuePair <TState, IState> > finishable)
        {
            var activeHierarchyPath = hsm.GetActiveHierarchyPath();

            foreach (var state in activeHierarchyPath)
            {
                if (finishable(state))
                {
                    return;
                }
            }
        }
        public static void ForeachState <TState, TTrigger>(this IStateMachine <TState, TTrigger> fsm, ReturnTrueToFinishIteration <TState> finishable)
        {
            TState[] states = fsm.GetStates();

            foreach (TState state in states)
            {
                if (finishable(state))
                {
                    return;
                }
            }
        }