/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (KeyMouseReader.KeyPressed(Keys.Space)) { AIControlled = !AIControlled; //crashes = 0; //roundStart = DateTime.Now; } SpawnBall(); ClearBalls(); if (AIControlled) { AIcontrol.Update(gameTime); } else { if (KeyMouseReader.KeyPressed(Keys.Escape)) { this.Exit(); } if (Keyboard.GetState().IsKeyDown(Keys.A)) { controlShip.MoveLeft(); } if (Keyboard.GetState().IsKeyDown(Keys.D)) { controlShip.MoveRight(); } if (Keyboard.GetState().IsKeyDown(Keys.W)) { controlShip.IncreaseSpeed(); } if (Keyboard.GetState().IsKeyDown(Keys.S)) { controlShip.DecreaseSpeed(); } } for (int i = 0; i < objList.Count; i++) { objList[i].Update(gameTime); } controlShip.Update(gameTime); base.Update(gameTime); }
protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) //Click the Escape button to close the program. { this.Exit(); } KeyMouseReader.Update(); if (running) { spawn += (float)gameTime.ElapsedGameTime.TotalSeconds; foreach (Asteroid a in asteroid_list) { a.Update(gameTime); if (KeyMouseReader.LeftClick() || KeyMouseReader.RightClick()) { if (a.asteroid_boundingbox.Contains(KeyMouseReader.mouse_position)) //When you click this line will check to see if the mouse position is inside the asteroids boundingbox. { asteroid_list.Remove(a); //If the mouse position is inside the asteroids boundingbox, the asteroid is removed. sound_asteroid_hit.Play(); //It then plays the sound for asteroids getting hit. hud.Score += 1; //Increases the score in the HUD by one per destoryed asteroid. score = score + 1; //Increases the score in the window title by one per destroyed asteroid. this.Window.Title = "Asteroid Asteroids destroyed: " + score + " Buildings left: " + life; break; //Stops the if and updates the asteroid_list. } } if (a.asteroid_boundingbox.Intersects(city_boundingbox)) //When the asteroids boundingbox hits the city's boundingbox { asteroid_list.Remove(a); //The asteroid is removed. sound_city_hit.Play(); //Then the sound is played for when an asteroid hits the city. hud.Life -= 1; //Deceeases the amount of lives you have left in the HUD by one per asteroid that hits the city. life = life - 1; //Decreases the amount of lives you have left in the window title by one per asteroid that hits the city. this.Window.Title = "Asteroid Asteroids destroyed: " + score + " Buildings left: " + life; break; } } if (life == 0) //When you run out of lives, { this.Window.Title = "Asteroid Asteroids destroyed: " + score + " Buildings left: " + life + " The city is lost! Press Esc to run for your life!"; running = false; //the game stops. } } LoadAsteroid(); base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } KeyMouseReader.Update(); gm.Update(gameTime); base.Update(gameTime); }
protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } GamePlayManager.MouseRect(gameTime); camera.SetPosition(playerPos, gameState); UIKeyBinds(); switch (gameState) { case GameState.Start: break; case GameState.Play: playerPos = GamePlayManager.map.player.Position; GamePlayManager.InventorySlotCheck(); GamePlayManager.Update(gameTime); break; case GameState.Inventory: GamePlayManager.ItemUse(); break; case GameState.Over: break; case GameState.Menu: if (newGame) { menuComponent.ContinueEnable(); newGame = false; } break; } base.Update(gameTime); }
protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); Variables.Update(); TotalScore = KillBonus + HealthBonus + LevelBonus; MusicManager.Update(gameTime); switch (GameState) { case GameStateEnum.MainMenu: MainMenuManager.Update(gameTime); break; case GameStateEnum.GameActive: GamePlayManager.Update(gameTime); break; case GameStateEnum.HighScoreView: HighScoreDisplay.Update(gameTime); break; case GameStateEnum.Story: StoryMode.Update(gameTime); break; case GameStateEnum.GameOver: GameOverManager.Update(gameTime); break; case GameStateEnum.Pause: PauseManager.Update(gameTime); break; case GameStateEnum.MapMaker: MapMakerManager.Update(gameTime); break; case GameStateEnum.LevelSelector: LevelSelectorManager.Update(gameTime); break; default: throw new ArgumentOutOfRangeException(); } ButtonManager.Update(gameTime); base.Update(gameTime); }
protected override void Update(GameTime gameTime) { //if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) // Exit(); KeyMouseReader.Update(); switch (gameState) { case GameState.menu: menu.Update(); break; case GameState.gamePlay: gameManager.Update(gameTime); break; } base.Update(gameTime); }
protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (KeyMouseReader.KeyClick(Keys.Escape)) { Exit(); } //Calculate delta and multiply it with 2.2. float delta = (float)gameTime.ElapsedGameTime.TotalSeconds; delta *= 2.2f; //Update the simulation world. world.Update(delta); base.Update(gameTime); }
protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (EXIT) { Exit(); } if (RELOADGAMEPLAY) { gameManager = new GameManager(screenWidth, screenHeight, tileSize); RELOADGAMEPLAY = false; menu.run = Menu.RunTime.Continued; gameState = GameState.gamePlay; } UpdateScreens(gameTime); base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); // Allows the game to exit if (KeyMouseReader.KeyPressed(Keys.Escape)) { this.Exit(); } if (KeyMouseReader.KeyPressed(Keys.F2)) { BAM.BlocksToggle(); } if (KeyMouseReader.KeyPressed(Keys.F3)) { BAM.LBIToggle(); } BAM.Update(gameTime); // TODO: Add your update logic here base.Update(gameTime); }
protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (KeyMouseReader.KeyPressed(Keybinds.binds["toggleFullscreen"])) { graphics.IsFullScreen = !graphics.IsFullScreen; graphics.ApplyChanges(); } switch (currentGameState) { case (GameState.Menus): startMenu.Update(); if (KeyMouseReader.KeyPressed(Keybinds.binds["back"])) { this.Exit(); } break; case (GameState.World): map.Update(gameTime); string previousZoneName = map.zoneName; PortalEntity temporaryPortal = map.ZoneSwitch(); if (temporaryPortal != null) { fileName = temporaryPortal.zoneName; Player tempPlayer = map.player; TabManager tab = map.tabManager; map = FileReader.ReadMap(fileName); map.player = tempPlayer; map.player.position = temporaryPortal.spawnPosition; map.player.map = map; map.tabManager = tab; if (map.zoneName != previousZoneName) { MediaPlayer.Play(Archive.songDictionary[map.zoneName]); } } if (map.EngageCombatBool(ref combat) == true) { currentGameState = GameState.Combat; } if (KeyMouseReader.KeyPressed(Keys.Escape)) { currentGameState = GameState.Menus; MediaPlayer.Stop(); } break; case (GameState.Combat): combat.Update(gameTime); if (!combat.active && !combat.fadingOut) { MediaPlayer.Play(Archive.songDictionary[map.zoneName]); currentGameState = GameState.World; foreach (Quest q in map.tabManager.questTab.questSystem.quests) { foreach (Objective o in q.objectives) { if (o is KillObjective) { KillObjective oKill = (KillObjective)o; oKill.CompareTeam(combat.enemyID); } } } if (combat.winnerTeam == 2) { Initialize(); } else { map.player.team.characters[0].Heal((int)(map.player.team.characters[0].maxHealth * 0.2f)); } } if (KeyMouseReader.KeyPressed(Keybinds.binds["back"])) { this.Exit(); } break; case (GameState.WorldEditor): mapEditor.Update(); if (KeyMouseReader.KeyPressed(Keybinds.binds["back"])) { currentGameState = GameState.Menus; } break; } base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); now = DateTime.Now; // Allows the game to exit if (KeyMouseReader.KeyPressed(Keys.Escape)) { this.Exit(); } if (KeyMouseReader.KeyPressed(Keys.A) && !AIControlled) { controlCar.MoveLeft(); } if (KeyMouseReader.KeyPressed(Keys.D) && !AIControlled) { controlCar.MoveRight(); } if (KeyMouseReader.KeyPressed(Keys.Space)) { AIControlled = !AIControlled; crashes = 0; roundStart = DateTime.Now; } if (AIControlled) { AI.Update(gameTime); } spawnCounter++; if (spawnCounter > spawnAt) { int tries = 0; while (tries < 1) { if (SpawnCar()) { break; } tries++; } /* * int randLane = rand.Next(0, Globals.lanes); * FallingCar newCar = new FallingCar(randLane, (float)(rand.NextDouble() * 7) + 1f); * float TTLPlusCar = newCar.getTTLBeforeCar(); * if (queueList[randLane].Count > 0) * { * if (TTLPlusCar > queueList[randLane].Last.Value.TTL) * { * queueList[randLane].AddLast(newCar); * spawnCounter = 0; * } * } * else * { * queueList[randLane].AddLast(newCar); * spawnCounter = 0; * }*/ } foreach (LinkedList <FallingCar> l in queueList) { foreach (FallingCar f in l) { f.Update(gameTime); } if (l.First != null && l.First.Value.TTL < 0) { l.RemoveFirst(); } } controlCar.Update(gameTime); //testCar2.Update(gameTime); // TODO: Add your update logic here base.Update(gameTime); }
protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { this.Exit(); } KeyMouseReader.Update(); foreach (Ship s in p1_ships) { s.Update(gameTime); } foreach (Ship s in p2_ships) { s.Update(gameTime); } foreach (Tile g in p1_grid) { g.Update(gameTime); } foreach (Tile g in p2_grid) { g.Update(gameTime); } if (!running) { if (!ship_placement) { if (KeyMouseReader.LeftClick() && KeyMouseReader.mouse_position.X < 500 && !grab_p1) { ship_to_move = ship_selected(); if (ship_to_move != null) { grab_p1 = true; } } else if (grab_p1) { ship_to_move.ship_pos = new Vector2(KeyMouseReader.mouse_position.X, KeyMouseReader.mouse_position.Y); if (KeyMouseReader.LeftClick()) { if (ship_on_ship()) { ship_to_move.ship_pos.X = (((int)ship_to_move.ship_pos.X / 50) * 50 + ship_to_move.ship_frame_size.Y / 2 + 3); ship_to_move.ship_pos.Y = (((int)ship_to_move.ship_pos.Y / 50) * 50 + ship_to_move.ship_frame_size.Y / 2 + 3); grab_p1 = false; } if (ship_to_move.ship_bounding_box.Right >= 500 || ship_to_move.ship_bounding_box.Top <= 3 || ship_to_move.ship_bounding_box.Left <= 3 || ship_to_move.ship_bounding_box.Bottom >= 500) { grab_p1 = true; } } } if (Keyboard.GetState().IsKeyDown(Keys.Space) && grab_p1 == false) { ship_placement = true; } } if (ship_placement && !play) { if (KeyMouseReader.LeftClick() && KeyMouseReader.mouse_position.X > 700 && !grab_p2) { ship_to_move = ship_selected(); if (ship_to_move != null) { grab_p2 = true; } } else if (grab_p2) { ship_to_move.ship_pos = new Vector2(KeyMouseReader.mouse_position.X, KeyMouseReader.mouse_position.Y); if (KeyMouseReader.LeftClick()) { if (ship_on_ship()) { ship_to_move.ship_pos.X = (((int)ship_to_move.ship_pos.X / 50) * 50 + ship_to_move.ship_frame_size.Y / 2) - 3; ship_to_move.ship_pos.Y = (((int)ship_to_move.ship_pos.Y / 50) * 50 + ship_to_move.ship_frame_size.Y / 2) + 2; grab_p2 = false; } if (ship_to_move.ship_bounding_box.Right >= 1197 || ship_to_move.ship_bounding_box.Top <= 3 || ship_to_move.ship_bounding_box.Left <= 697 || ship_to_move.ship_bounding_box.Bottom >= 500) { grab_p2 = true; } } } if (Keyboard.GetState().IsKeyDown(Keys.Enter) && grab_p2 == false) { play = true; } } if (play == true) { if (KeyMouseReader.LeftClick()) { Tile tile = tile_selected(); if (tile != null && KeyMouseReader.mouse_position.X > 700 && KeyMouseReader.mouse_position.Y < 500 && !player_turn) { if (tile.hit == true || tile.miss == true) { shoot = false; } else { shoot = true; } if (shoot == true) { Ship temp = get_ship(tile.tile_bb); if (temp != null && tile.hit == false && tile.miss == false) { tile.hit = true; hit_p1 += 1; temp.ship_life -= 1; hit_sound.Play(); } else { tile.miss = true; miss_p1 += 1; miss_sound.Play(); } player_turn = true; } } if (tile != null && KeyMouseReader.mouse_position.X < 500 && KeyMouseReader.mouse_position.Y < 500 && player_turn) { if (tile.hit == true || tile.miss == true) { shoot = false; } else { shoot = true; } if (shoot == true) { Ship temp = get_ship(tile.tile_bb); if (temp != null && tile.hit == false && tile.miss == false) { tile.hit = true; hit_p2 += 1; temp.ship_life -= 1; hit_sound.Play(); } else { tile.miss = true; miss_p2 += 1; miss_sound.Play(); } player_turn = !player_turn; } } } } if (hit_p1 == 17 || hit_p2 == 17) { running = true; } base.Update(gameTime); } }
protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (!gameOverSound && gameOver) { MediaPlayer.Stop(); MediaPlayer.IsRepeating = false; MediaPlayer.Play(gameOver_sfx); gameOverSound = true; } if (gameOver) { playerinfo = "Press enter to restart"; showPlayerInfo = true; if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { Initialize(); } } if (KeyMouseReader.KeyPressed(Keys.P)) { paused = !paused; } if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { this.Exit(); } if (showPlayerInfo) { playerinfoTime += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (playerinfoTime > 9) { showPlayerInfo = false; playerinfoTime = 0; } audioEngine.Update(); if (gameOver || paused) { return; } this.Window.Title = "AsteroidKiller Score: " + playerScore.ToString(); player.Update(); bg1.Update(); bg2.Update(); bg3.Update(); //Difficulty diffLevel = playerTime1 / 15 + playerScore / 10000; maxAsteroids = 10 + diffLevel * 3; rMinSpeed = 1 + diffLevel / 8; rMaxSpeed = 4 + diffLevel / 4; if (SpawnRate > 1) { SpawnRate = 200 - diffLevel * 7; } if (SpawnRate < 1) { SpawnRate = 1; } //Bullet logic foreach (Bullet bullet in bullets) { bullet.Update(); foreach (Asteroid asteroid in asteroids) { asteroid.Collision(bullet.hitbox); if (!piercingBullets) { bullet.Collision(asteroid.hitbox); } } } if (KeyMouseReader.LeftClickPressed() && nextShot >= 60 && !player.dead) { ShootBullet(); nextShot = 0; } if (nextShot < 60) { nextShot += shotRate; } for (int i = bullets.Count - 1; i >= 0; i--) { if (bullets[i].bulletHitAsteroid) { playerScore += 100; } if (bullets[i].removeBullet) { bullets.RemoveAt(i); } } //Asteroid Logic foreach (Asteroid asteroid in asteroids) { asteroid.Update(); player.Collision(asteroid.hitbox); } foreach (Asteroid asteroid in asteroids) { foreach (Asteroid asteroid2 in asteroids) { if (asteroid2 != asteroid && asteroid.scale > 0.7 && asteroid2.scale > 0.7) //Collision with other asteroids { asteroid.Collision(asteroid2.hitbox); asteroid2.Collision(asteroid.hitbox); } } if (asteroid.destroyAsteroid) { asteroid.texture = explosion_texture; } } foreach (Asteroid asteroid in asteroids) { if (asteroid.spawnDaughters) //Logic for spawning "daughter" asteroids { rHitbox = new Rectangle((int)asteroid.pos.X, (int)asteroid.pos.Y, asteroid_texture.Width, asteroid_texture.Height); Vector2 daughterSpeed, daughterSpeed2; daughterSpeed = new Vector2(asteroid.speed.X, rand.Next(-2, 2)); daughterSpeed2 = new Vector2(rand.Next(-2, 2), asteroid.speed.Y); asteroids.Add(new Asteroid(asteroid_texture, asteroid.pos, daughterSpeed, rHitbox, asteroid.scale / 2)); asteroids.Add(new Asteroid(asteroid_texture, asteroid.pos, daughterSpeed2, rHitbox, asteroid.scale / 2)); asteroid.spawnDaughters = false; break; } } nextSpawn += rand.Next(1, 5); if (nextSpawn >= SpawnRate && asteroids.Count < maxAsteroids) { SpawnRandom(); //Randomize position/speed of asteroid rScale = (11 - rand.Next(1, 4)) * 0.12f; //Randomize size of asteroid rHitbox = new Rectangle((int)rPos.X, (int)rPos.Y, asteroid_texture.Width, asteroid_texture.Height); asteroids.Add(new Asteroid(asteroid_texture, rPos, rSpeed, rHitbox, rScale)); nextSpawn = 0; } for (int i = asteroids.Count - 1; i >= 0; i--) //Goes through list in reverse order to avoid rearrangement in list { if (asteroids[i].destroyAsteroid && asteroids[i].animationTime > 10) { if (asteroidSounds < 3) //Prevents sound overlap from more than 3 explosions on the same frame { soundBank.PlayCue("boom6"); ++asteroidSounds; } asteroids.RemoveAt(i); } } asteroidSounds = 0; //Player Logic if (player.dead) { player.texture = player_explode; if (player.animationTime == 1) { soundBank.PlayCue("boom1"); } if (player.animationTime >= 100) //Checks to see whether animation has ended { player.pos = playerStartPos; player.speed = Vector2.Zero; player.texture = player_texture; playerLives -= 1; player.invulnerable = true; player.dead = false; } if (player.animationTime >= 100) { player.animationTime = 0; } } if (playerLives <= 0) { gameOver = true; } if (player.invulnerable) { playerInvulnerableCount += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (playerInvulnerableCount >= playerInvulnerableTime) { player.invulnerable = false; playerInvulnerableCount = 0; } playerTime += (float)gameTime.ElapsedGameTime.TotalSeconds; playerTime1 = (int)playerTime; //Powerup logic powerup.Update(); if (!powerupExists) { powerupCounter += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (powerupCounter >= nextPowerup) { SpawnRandom(); rHitbox = new Rectangle((int)rPos.X, (int)rPos.Y, powerup_texture.Width, powerup_texture.Height); powerup = new Powerup(powerup_texture, rPos, rSpeed * 0.5f, rHitbox, rand.Next(1, 6)); powerupExists = true; nextPowerup = rand.Next(10, 20); powerupCounter = 0; } powerup.Collision(player.hitbox); if (powerup.playerGotPowerup) { switch (powerup.id) { case 1: playerLives += 1; DisplayPlayerInfo(" Life up!"); soundBank.PlayCue("se_bonus"); break; case 2: shotRate = 14; powerupTime = 0; powerupActive = true; DisplayPlayerInfo(" Fire rate doubled!"); soundBank.PlayCue("se_ch02"); break; case 3: foreach (Asteroid asteroid in asteroids) { asteroid.destroyAsteroid = true; } DisplayPlayerInfo(" KABOOM"); soundBank.PlayCue("se_slash"); break; case 4: player.invulnerable = true; playerInvulnerableCount = -7; DisplayPlayerInfo(" Invulnerability!"); soundBank.PlayCue("se_chargeup"); break; case 5: piercingBullets = true; shotRate = 5; powerupTime = 0; powerupActive = true; DisplayPlayerInfo(" Asteroids are made of cheese!"); soundBank.PlayCue("se_charge00"); break; } powerup = new Powerup(powerup_texture, Vector2.Zero, Vector2.Zero, new Rectangle(-10, -10, 0, 0), 0); powerupExists = false; } if (powerupActive) { powerupTime += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (powerupTime >= 10) { shotRate = 7; piercingBullets = false; powerupActive = false; powerupTime = 0; } base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (KeyMouseReader.RightClick()) { camera.Update(new Vector2(KeyMouseReader.mouseState.X - camera.CameraPos.X, KeyMouseReader.mouseState.Y - camera.CameraPos.Y)); } grid.Update(new Vector2(KeyMouseReader.mouseState.X, KeyMouseReader.mouseState.Y)); if (navigateTabs == NavigationTabs.ChooseObject) { if (chooseObject == ChooseObject.Player) { grid.tileType = TileGrid.TileType.AddPlayer; } else if (chooseObject == ChooseObject.Wall) { grid.tileType = TileGrid.TileType.AddWall; } else if (chooseObject == ChooseObject.Teleport) { grid.tileType = TileGrid.TileType.AddTeleport; } else if (chooseObject == ChooseObject.EnemySpawner) { grid.tileType = TileGrid.TileType.AddSpawner; } else if (chooseObject == ChooseObject.Pistol) { grid.tileType = TileGrid.TileType.AddPistol; } } hud.Update(camera.CameraPos); if (navigateTabs == NavigationTabs.SetGrid) { SetGrid(); } else if (navigateTabs == NavigationTabs.ChooseTool && chooseTool == ChooseTools.SaveLevel) { grid.SaveToJsonFile(); Console.WriteLine("SAVED"); chooseTool = ChooseTools.AddTiles; hud.selected = 0; } switch (navigateTabs) { case NavigationTabs.ChooseTool: if (KeyMouseReader.KeyPressed(Keys.Escape)) { navigateTabs = NavigationTabs.SetGrid; } if (KeyMouseReader.KeyPressed(Keys.Enter)) { if (hud.selected == 0) { chooseTool = ChooseTools.AddTiles; navigateTabs = NavigationTabs.ChooseCategory; } else if (hud.selected == 1) { chooseTool = ChooseTools.RemoveTiles; } else if (hud.selected == 2) { chooseTool = ChooseTools.SaveLevel; } hud.selected = 0; } break; case NavigationTabs.ChooseCategory: if (KeyMouseReader.KeyPressed(Keys.Escape)) { navigateTabs = NavigationTabs.ChooseTool; } if (KeyMouseReader.KeyPressed(Keys.Enter)) { if (hud.selected == 0) { chooseCategory = ChooseCategory.Characters; } else if (hud.selected == 1) { chooseCategory = ChooseCategory.Environment; } else if (hud.selected == 2) { chooseCategory = ChooseCategory.Weapons; } hud.selected = 0; navigateTabs = NavigationTabs.ChooseObject; } break; case NavigationTabs.ChooseObject: if (KeyMouseReader.KeyPressed(Keys.Escape)) { navigateTabs = NavigationTabs.ChooseCategory; } if (KeyMouseReader.KeyPressed(Keys.Enter)) { if (chooseCategory == ChooseCategory.Characters) { if (hud.selected == 0) { chooseObject = ChooseObject.Player; } else if (hud.selected == 1) { chooseObject = ChooseObject.EnemySpawner; } else if (hud.selected == 2) { chooseObject = ChooseObject.Enemy; } } else if (chooseCategory == ChooseCategory.Environment) { if (hud.selected == 0) { chooseObject = ChooseObject.Wall; } else if (hud.selected == 1) { chooseObject = ChooseObject.Teleport; } } else if (chooseCategory == ChooseCategory.Weapons) { if (hud.selected == 0) { chooseObject = ChooseObject.Pistol; } } } break; } // TODO: Add your update logic here base.Update(gameTime); }