// on updates do animations and controls protected override void Update(double deltaTime) { // if user click 'exit' action, exit game if (Input.Down("exit")) { Game.Exit(); } // play sound effects if (Input.PressedNow(KeyCodes.Key1)) { Sfx.PlaySound(_sound, 100, 0, 0.25f); } if (Input.PressedNow(KeyCodes.Key2)) { Sfx.PlaySound(_sound, 100, 0, 0.5f); } if (Input.PressedNow(KeyCodes.Key3)) { Sfx.PlaySound(_sound, 100, 0, 0.75f); } if (Input.PressedNow(KeyCodes.Key4)) { Sfx.PlaySound(_sound, 100, 0, 1f); } if (Input.PressedNow(KeyCodes.Key5)) { Sfx.PlaySound(_sound, 100, 0, 1.25f); } if (Input.PressedNow(KeyCodes.Key6)) { Sfx.PlaySound(_sound, 100, 0, 1.5f); } if (Input.PressedNow(KeyCodes.Key7)) { Sfx.PlaySound(_sound, 100, 0, 1.75f); } // pause / resume music if (Input.PressedNow(KeyCodes.KeySpace)) { _paused = !_paused; Sfx.PauseMusic(_paused); } }
// on updates do animations and controls protected override void Update(double deltaTime) { // if user click 'exit' action, exit game if (Input.Down("exit")) { Game.Exit(); } // play sound effects if (Input.PressedNow(KeyCodes.Key1)) { Sfx.PlaySound(_sound, 100, 0, 0.25f); } if (Input.PressedNow(KeyCodes.Key2)) { Sfx.PlaySound(_sound, 100, 0, 0.5f); } if (Input.PressedNow(KeyCodes.Key3)) { Sfx.PlaySound(_sound, 100, 0, 0.75f); } if (Input.PressedNow(KeyCodes.Key4)) { Sfx.PlaySound(_sound, 100, 0, 1f); } if (Input.PressedNow(KeyCodes.Key5)) { Sfx.PlaySound(_sound, 100, 0, 1.25f); } if (Input.PressedNow(KeyCodes.Key6)) { Sfx.PlaySound(_sound, 100, 0, 1.5f); } if (Input.PressedNow(KeyCodes.Key7)) { Sfx.PlaySound(_sound, 100, 0, 1.75f); } // do music switching if (Input.PressedNow(KeyCodes.KeyZ)) { _musicFader = new MusicFader(_musicFader.ToTrack, _musicFader.CurrentVolume, _music, 100); } if (Input.PressedNow(KeyCodes.KeyX)) { _musicFader = new MusicFader(_musicFader.ToTrack, _musicFader.CurrentVolume, _altMusic, 30); } // pause / resume music if (Input.PressedNow(KeyCodes.KeySpace)) { _paused = !_paused; Sfx.PauseMusic(_paused); } // update music fader if (_musicFader != null && !_paused) { _musicFader.Update(deltaTime); } }