protected override void Update(GameTime gameTime) { ///WE COULD USE THE INPUTADVANCED, but we did not. ///Sometimes the state of a key remains down more than one frame if (Keyboard.GetState().IsKeyDown(Keys.Space)) { se.Play(); } if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { se.Pause(); } if (Keyboard.GetState().IsKeyDown(Keys.RightAlt)) { ap.PlaySoundEffect("bye"); } if (Keyboard.GetState().IsKeyDown(Keys.RightShift)) { ap.StopSoundEffect("bye"); } if (Keyboard.GetState().IsKeyDown(Keys.RightControl)) { sound.Stop(true); } base.Update(gameTime); }
protected override void Update(GameTime gameTime) { //if (Keyboard.GetState().IsKeyDown(Keys.Space)) //{ // se.Play(); //} //if (Keyboard.GetState().IsKeyDown(Keys.Enter)) //{ // se.Pause(); //} //if (Keyboard.GetState().IsKeyDown(Keys.RightAlt)) //{ // ap.PlaySoundEffect("bye"); //} //if (Keyboard.GetState().IsKeyDown(Keys.RightShift)) //{ // ap.StopSoundEffect("bye"); //} if (Keyboard.GetState().IsKeyDown(Keys.LeftControl)) { this.World.RemoveSoundEmitter(sound); sound = new Static3DSound(GraphicFactory, "Songs/pianosong", Vector3.Zero); this.World.AddSoundEmitter(sound, true); sound.Play(); } if (Keyboard.GetState().IsKeyDown(Keys.RightControl)) { sound.Stop(true); } base.Update(gameTime); }