protected override void UpdateWorld() { keyboard.update(); MouseDevice.Update(); if (state == GameState.Normal) { GameObjects.update(); update(); if (keyboard.isKeyTapped(Keys.Escape)) { state = GameState.Paused; GameObjects.pause(); PlayBackgroundAudio(backgroundMusic, 0); } if (keyboard.isKeyTapped(Keys.F1)) { setDebugMode(!getDebugMode()); } } else if (state == GameState.Gameover || state == GameState.Win) { if (endScreen.readyToReplay()) { GameObjects.destroy(); allDecorations.destroy(); InitializeWorld(); } else { endScreen.update(); } } else if (state == GameState.Paused) { if (keyboard.isKeyTapped(Keys.Escape)) { state = GameState.Normal; GameObjects.resume(); PlayBackgroundAudio(backgroundMusic, gameVolume); } } else if (state == GameState.StartScreen) { if (startScreen.isReady()) { initializeGame(); } else { startScreen.update(); } } }