Example #1
0
 private async Task NextStateHandeling()
 {
     while (nextState != null)
     {
         currentState = nextState;
         nextState    = null;
         await currentState.OnEnter(enterParameters);
     }
 }
Example #2
0
        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();
        }
Example #3
0
 public void AddState(string stateId, IStateEngineState state)
 {
     stateIdMap.Add(stateId, state);
     state.SetStateEngine(this);
 }