public override void Update(GameTime gameTime) { base.Update(gameTime); stages.Update(gameTime); points.Update(gameTime); wind.Update(gameTime); enemyVelo.Update(gameTime); ballRadius.Update(gameTime); back.Update(gameTime); play.Update(gameTime); if (active < 5) { options[active].Active = false; } else { for (int i = 0; i < 5; i++) { options[i].Active = false; } } if (InputManager.Instance.ButtonPressed(Buttons.DPadDown, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown) || InputManager.Instance.KeyPressed(Keys.Down)) { GameStateManager.Instance.Menu.Play2D("Content//Sound//button.ogg", false); if (active == 6) { active = 0; } else { active += 1; } } if (InputManager.Instance.ButtonPressed(Buttons.DPadUp, Buttons.LeftThumbstickUp, Buttons.RightThumbstickUp) || InputManager.Instance.KeyPressed(Keys.Up)) { GameStateManager.Instance.Menu.Play2D("Content//Sound//button.ogg", false); if (active == 0) { active = 6; } else { active -= 1; } } if (active == 5) { if (InputManager.Instance.ButtonPressed(Buttons.DPadRight, Buttons.LeftThumbstickRight, Buttons.RightThumbstickRight) || InputManager.Instance.KeyPressed(Keys.Right)) { GameStateManager.Instance.Menu.Play2D("Content//Sound//button.ogg", false); active = 6; } } if (active == 6) { if (InputManager.Instance.ButtonPressed(Buttons.DPadLeft, Buttons.LeftThumbstickLeft, Buttons.RightThumbstickLeft) || InputManager.Instance.KeyPressed(Keys.Left)) { GameStateManager.Instance.Menu.Play2D("Content//Sound//button.ogg", false); active = 5; } } if (active < 5) { options[active].Active = true; back.isActive = false; play.isActive = false; back.DeactivateEffect("FadeEffect"); play.DeactivateEffect("FadeEffect"); back.Alpha = 1.0f; play.Alpha = 1.0f; } else { if (active == 5) { back.isActive = true; back.ActivateEffect("FadeEffect"); play.isActive = false; play.DeactivateEffect("FadeEffect"); play.Alpha = 1.0f; } else { play.isActive = true; play.ActivateEffect("FadeEffect"); back.isActive = false; back.DeactivateEffect("FadeEffect"); back.Alpha = 1.0f; } } if ((back.isActive && (InputManager.Instance.ButtonPressed(Buttons.A) || InputManager.Instance.KeyPressed(Keys.Enter))) || InputManager.Instance.ButtonPressed(Buttons.B) || InputManager.Instance.KeyPressed(Keys.Escape)) { GameStateManager.Instance.ChangeScreens("TitleScreen"); } if (play.isActive && (InputManager.Instance.ButtonPressed(Buttons.A) || InputManager.Instance.KeyPressed(Keys.Enter))) { if (stages.active == 0) { IceField field = new IceField(100, 90, 15, rnd); field.Initialize(); GameScreen.Instance.SoundFileName = "Content//Sound//soproSound1.ogg"; Pinguin one, two; if (GamePad.GetState(PlayerIndex.Two).IsConnected) { one = new Pinguin(new Vector3(0, -25, 0), 5, 0, 0.5f, 0.8f, field, PlayerIndex.One); two = new Pinguin(new Vector3(0, 25, 0), 5, 0, 0.5f, 0.8f, field, PlayerIndex.Two); } else { one = new Pinguin(new Vector3(0, -25, 0), 5, 0, 0.5f, 0.8f, field); two = new Pinguin(new Vector3(0, 25, 0), 5, 0, 0.5f, 0.8f, field, PlayerIndex.One); } one.Enemy = two; two.Enemy = one; int w = 0; if (wind.Array[wind.active]) { w = 1; } GameScreen.Instance.Match = new Match(one, two, field, points.Array[points.active], w, ballRadius.Array[ballRadius.active], enemyVelo.Array[enemyVelo.active]); GameStateManager.Instance.ChangeScreens("GameScreen"); } if (stages.active == 1) { MeadowField field = new MeadowField(100, 90, 15, rnd); field.Initialize(); GameScreen.Instance.SoundFileName = "Content//Sound//hummel.ogg"; BumbleBee one, two; if (GamePad.GetState(PlayerIndex.Two).IsConnected) { one = new BumbleBee(new Vector3(0, -25, 5), 10, 5, 0.5f, 0.8f, field, PlayerIndex.One); two = new BumbleBee(new Vector3(0, 25, 5), 10, 5, 0.5f, 0.8f, field, PlayerIndex.Two); } else { one = new BumbleBee(new Vector3(0, -25, 5), 10, 5, 0.5f, 0.8f, field); two = new BumbleBee(new Vector3(0, 25, 5), 10, 5, 0.5f, 0.8f, field, PlayerIndex.One); } one.Enemy = two; two.Enemy = one; int w = 0; if (wind.Array[wind.active]) { w = 1; } GameScreen.Instance.Match = new Match(one, two, field, points.Array[points.active], w, ballRadius.Array[ballRadius.active], enemyVelo.Array[enemyVelo.active]); GameStateManager.Instance.ChangeScreens("GameScreen"); } if (stages.active == 2) { WaterField field = new WaterField(100, 90, 15, rnd); field.Initialize(); Dolphin one, two; GameScreen.Instance.SoundFileName = "Content//Sound//Delphin.ogg"; if (GamePad.GetState(PlayerIndex.Two).IsConnected) { one = new Dolphin(new Vector3(0, -25, 0), 5, 0, 0.5f, 0.8f, field, PlayerIndex.One); two = new Dolphin(new Vector3(0, 25, 0), 5, 0, 0.5f, 0.8f, field, PlayerIndex.Two); } else { one = new Dolphin(new Vector3(0, -25, 0), 5, 0, 0.5f, 0.8f, field); two = new Dolphin(new Vector3(0, 25, 0), 5, 0, 0.5f, 0.8f, field, PlayerIndex.One); } one.Enemy = two; two.Enemy = one; int w = 0; if (wind.Array[wind.active]) { w = 1; } GameScreen.Instance.Match = new Match(one, two, field, points.Array[points.active], w, ballRadius.Array[ballRadius.active], enemyVelo.Array[enemyVelo.active]); GameStateManager.Instance.ChangeScreens("GameScreen"); } } }
public override void Update(GameTime gameTime) { base.Update(gameTime); ingame.Update(gameTime); music.Update(gameTime); save.Update(gameTime); fullscreen.Update(gameTime); bg.Update(gameTime); background.Update(gameTime); if (active < 3) { options[active].Active = false; } else { for (int i = 0; i < 3; i++) { options[i].Active = false; } } if (InputManager.Instance.ButtonPressed(Buttons.DPadDown, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown) || InputManager.Instance.KeyPressed(Keys.Down)) { GameStateManager.Instance.Menu.Play2D("Content//Sound//button.ogg", false); if (active == 3) { active = 0; } else { active += 1; } } if (InputManager.Instance.ButtonPressed(Buttons.DPadUp, Buttons.LeftThumbstickUp, Buttons.RightThumbstickUp) || InputManager.Instance.KeyPressed(Keys.Up)) { GameStateManager.Instance.Menu.Play2D("Content//Sound//button.ogg", false); if (active == 0) { active = 3; } else { active -= 1; } } if (active < 3) { options[active].Active = true; save.isActive = false; save.DeactivateEffect("FadeEffect"); save.Alpha = 1.0f; } else { save.isActive = true; save.ActivateEffect("FadeEffect"); } if (save.isActive && (InputManager.Instance.ButtonPressed(Buttons.A) || InputManager.Instance.KeyPressed(Keys.Enter))) { //Speichern GameStateManager.Instance.IngameVolume = ingame.Array[ingame.active]; GameStateManager.Instance.MusicVolume = music.Array[music.active]; GameStateManager.Instance.Fullscreen = fullscreen.Array[fullscreen.active]; XmlManager <GameStateManager> xml = new XmlManager <GameStateManager>(); xml.Save("Content/Load/GameStateManager.xml", GameStateManager.Instance); GameStateManager.Instance.Music.SoundVolume = ((float)GameStateManager.Instance.MusicVolume) / 100; GameStateManager.Instance.Ingame.SoundVolume = ((float)GameStateManager.Instance.IngameVolume) / 100; GameStateManager.Instance.ChangeScreens("Options"); } if (InputManager.Instance.ButtonPressed(Buttons.B) || InputManager.Instance.KeyPressed(Keys.Escape)) { GameStateManager.Instance.ChangeScreens("Options"); } }