diff --git a/FSM/StateMachine.cs b/FSM/StateMachine.cs index 6d2f24a..b36473d 100644 --- a/FSM/StateMachine.cs +++ b/FSM/StateMachine.cs @@ -71,28 +71,16 @@ public State NewState(TState stateName) public StateMachine Any(Func valid, Action transfer,TState to) { foreach (State state in m_States) - { if (to.GetHashCode() != state.GetStateInt()) - { - Transition transition = new Transition(state, valid).Transfer(transfer); - transition.To(to); - state.Transitions.Add(transition); - } - } + state.Translate(valid).Transfer(transfer).To(to); return this; } public StateMachine Where(TState from, Func valid, Action transfer, TState to) { foreach(State state in m_States) - { if ((from.GetHashCode() & state.GetStateInt()) == state.GetStateInt()) - { - Transition transition = new Transition(state, valid).Transfer(transfer); - transition.To(to); - state.Transitions.Add(transition); - } - } + state.Translate(valid).Transfer(transfer).To(to); return this; } public StateMachine Initialize()