/// <summary> /// hanges the active state to the given state type. An instance of that type should /// already had been registered to use this method. /// </summary> /// <typeparam name="TState">The State you want to change to</typeparam> /// <returns></returns> public TState ChangeState <TState>() where TState : IFsmState <T> { PreviousState = CurrentState; CurrentState = stateDictionary[typeof(TState)]; PreviousState.End(); CurrentState.Begin(); return((TState)CurrentState); }