// Make sure you init the Machine public bool ChangeState(T state) { if (state.Equals(_CurrentState)) { return(false); } else { _CurrentMapping.Exit(); _CurrentState = state; _CurrentMapping = _StateLookup[state]; _CurrentMapping.Enter(); return(true); } }
public void Init(T initState) { _CurrentState = initState; _CurrentMapping = _StateLookup[initState]; _CurrentMapping.Enter(); }