private async Task NextStateHandeling() { while (nextState != null) { currentState = nextState; nextState = null; await currentState.OnEnter(enterParameters); } }
public async Task Start(string initialState, IEnterParameters parameters = null) { currentState = null; stateIdMap.TryGetValue(initialState, out currentState); if (currentState == null) { throw new NotSupportedException($"Ther is no state for state id '{initialState}'"); } await currentState.OnEnter(enterParameters); await NextStateHandeling(); }