private void checkControl() { KeyboardDevice.update(); if (KeyboardDevice.isKeyDown(Keys.Escape)) { Exit(); } switch (state) { case State.BEGIN: if (KeyboardDevice.isKeyTapped(Keys.A)) { state = State.PLAYING; startScreen.remove(); } break; case State.PAUSED: if (KeyboardDevice.isKeyTapped(Keys.A)) { state = State.PLAYING; pauseScreen.remove(); } if (KeyboardDevice.isKeyTapped(Keys.Q)) { state = State.BEGIN; world.remove(); world = new GameWorld(); pauseScreen.remove(); } break; case State.PLAYING: if (KeyboardDevice.isKeyTapped(Keys.A)) { state = State.PAUSED; } else if (world.gameOver()) { state = State.GAMEOVER; } break; case State.GAMEOVER: if (KeyboardDevice.isKeyTapped(Keys.A)) { state = State.BEGIN; world.remove(); world = new GameWorld(); gameOverScreen.remove(); } break; } }
// Initialize the game world protected override void InitializeWorld() { //SetAppWindowPixelDimension(FULLSCREEN, 1920, 1080); World.SetWorldCoordinate(new Vector2(0f, 0f), 100); preloadTexturedObjects(); loadControllerObjects(); state = State.BEGIN; world = new GameWorld(); }