public void SetStateByName(string wantedState) { if (wantedState != null && wantedState != currentState.GetType().Name) { SwitchToNewState(wantedState); } }
private void SwitchToNewState(string newState) { currentState = possibleStates[newState]; currentStateName = currentState.GetType().Name; }