public void HandleInput(InputHelper inputHelper) { //If P is pressed, and you're not currently in the settings menu, the settings menu will be opened, //and the gamestate where you came from will be stored for potential use if (inputHelper.KeyPressed(Keys.P)) { if (currentGameState.ToString() == "MeesGame.SettingsMenuState") { SwitchTo(previousGameState); } else { previousGameState = currentGameState.ToString(); SwitchTo("SettingsMenuState"); } } if (inputHelper.KeyPressed(Keys.Escape)) { SwitchTo("TitleMenuState"); } if (currentGameState != null) { currentGameState.HandleInput(inputHelper); } }