public void SwicthState(State newState) { if (currentState != null) { currentState.Exit(); } currentState = newState; if (newState != null) { currentState.Enter(); } }