//################################# // Handle input //################################# public override void HandleInput(InputState input) { if (input == null) { throw new ArgumentNullException("input"); } // Look up inputs for the player. KeyboardState keyboardState = input.CurrentKeyboardState; // key for the ship etc. if (input.IsNewKeyPress(Keys.B)) { if ((Vector3.Distance(_station.Position, _droneFleet.GetActiveDrone().Position) - _stationHeight) < 150 && Global.DemoMode == "Gameplay") { //playing the sound _soundEngine.Play2D("openShop", Global.SpeakerVolume / 10, false); if (shop == null) { shop = new ShopScreen(_droneFleet, _station); } ScreenManager.AddScreen(shop); } if (Global.DemoMode == "Models") { _boidsActivate = true; } } if (Global.DemoMode == "Effects") { if (_input.IsNewKeyPress(Keys.C)) { _effect++; if (_effect > 2) { _effect = 0; } } if (_input.IsNewKeyPress(Keys.E)) { explosionList.Add(new ExplosionSystem(new ShipExplosionSettings(), _input.getMouseInWorldPos(), 0.4)); switch (_effect) { case 0: explosionList.Add(new ExplosionSystem(new ShipExplosionSettings(), _input.getMouseInWorldPos(), 0.4)); break; case 1: explosionList.Add(new ExplosionSystem(new ShipExplosionSettings(), new ShipRingExplosionSettings(), _input.getMouseInWorldPos(), 0.4, 30)); break; case 2: explosionList.Add(new ExplosionSystem(new BombExplosionSettings(), new BombRingExplosionSettings(), _input.getMouseInWorldPos(), 0.4, 50, true)); break; } } } //player hits ESC it pauses the game if (input.IsPauseGame()) { //playing the sound _soundEngine.Play2D("openShop", Global.SpeakerVolume / 10, false); if (pause == null) { pause = new DemoPauseMenuScreen(); } ScreenManager.AddScreen(pause); } }
//################################# // Handle input //################################# public override void HandleInput(InputState input) { if (input == null) { throw new ArgumentNullException("input"); } // Look up inputs for the player. KeyboardState keyboardState = input.CurrentKeyboardState; TutorialText.TryGetValue(nextIndex, out tutorialMessage); if (nextIndex == 0) { if (input.IsNewKeyPress(Keys.Y)) { Global.MusicEngine.StopAllSounds(); ScreenManager.AddScreen(new DemoGameplayScreen()); ScreenManager.RemoveScreen(this); } else if (input.IsNewKeyPress(Keys.N)) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; nextIndex++; TutorialText.TryGetValue(nextIndex, out tutorialMessage); } } else { // key for the ship etc. if (input.IsNewKeyPress(Keys.B)) { if ((Vector3.Distance(_station.Position, _droneFleet.GetActiveDrone().Position) - _stationHeight) < 150) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; if (shop == null) { shop = new ShopScreen(_droneFleet, _station); } ScreenManager.AddScreen(shop); } } if (input.IsNewKeyPress(Keys.Space) && (nextIndex + 1) < TutorialText.Count && (nextIndex + 1) > 0) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; nextIndex++; TutorialText.TryGetValue(nextIndex, out tutorialMessage); if (nextIndex == TutorialText.Count - 1) { movementAllowed = true; } } } if (input.IsNewKeyPress(Keys.Back) && nextIndex < TutorialText.Count && (nextIndex - 1) >= 0) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; nextIndex--; TutorialText.TryGetValue(nextIndex, out tutorialMessage); } if (movementAllowed) { if (input.IsNewKeyPress(Keys.X)) { Global.MusicEngine.StopAllSounds(); ScreenManager.AddScreen(new DemoGameplayScreen()); ScreenManager.RemoveScreen(this); } } //player hits ESC it pauses the game if (input.IsPauseGame()) { if (pause == null) { pause = new DemoPauseMenuScreen(); } ScreenManager.AddScreen(pause); } }