public override void Update(ref Screen activeScreen, GameTime gameTime) { if (!GameProperties.Instance.GameOver) { _lastFrame += gameTime.ElapsedGameTime.Milliseconds; if (_lastFrame > _time) { GameProperties.Instance.Score += (1 * GameProperties.Instance.Multiplier); _lastFrame = 0; } } else { if (GameProperties.Instance.Score > GameProperties.Instance.HighScore) { GameProperties.Instance.HighScore = GameProperties.Instance.Score; } } if (_backgroundMusic == null) { _backgroundMusic = Resources.Instance.GetSound("RockMusic").CreateInstance(); _backgroundMusic.IsLooped = true; _backgroundMusic.Volume = 0.5f; _backgroundMusic.Play(); } _currState = Keyboard.GetState(); if (GameProperties.Instance.GameOver && _currState.IsKeyDown(Keys.Enter)) { _game.Components.Remove(_keyboard); _game.Components.Remove(_spriteManager); _backgroundMusic.Stop(); GameProperties.Instance.GameOver = false; activeScreen = new StartScreen(_game, _spriteBatch); } if (GameProperties.Instance.GameOver && GameProperties.Instance.Reset) { GameProperties.Instance.Reset = false; _game.Components.Remove(_keyboard); _game.Components.Remove(_spriteManager); _backgroundMusic.Stop(); GameProperties.Instance.GameOver = false; activeScreen = new StartScreen(_game, _spriteBatch); } }
public override void Update(ref Screen activeScreen, GameTime gameTime) { if (!GameProperties.Instance.GameOver) { _lastFrame += gameTime.ElapsedGameTime.Milliseconds; if (_lastFrame > _time) { GameProperties.Instance.Score += ( 1 * GameProperties.Instance.Multiplier ); _lastFrame = 0; } } else { if (GameProperties.Instance.Score > GameProperties.Instance.HighScore) { GameProperties.Instance.HighScore = GameProperties.Instance.Score; } } if (_backgroundMusic == null) { _backgroundMusic = Resources.Instance.GetSound("RockMusic").CreateInstance(); _backgroundMusic.IsLooped = true; _backgroundMusic.Volume = 0.5f; _backgroundMusic.Play(); } _currState = Keyboard.GetState(); if (GameProperties.Instance.GameOver && _currState.IsKeyDown(Keys.Enter)) { _game.Components.Remove(_keyboard); _game.Components.Remove(_spriteManager); _backgroundMusic.Stop(); GameProperties.Instance.GameOver = false; activeScreen = new StartScreen(_game, _spriteBatch); } if (GameProperties.Instance.GameOver && GameProperties.Instance.Reset) { GameProperties.Instance.Reset = false; _game.Components.Remove(_keyboard); _game.Components.Remove(_spriteManager); _backgroundMusic.Stop(); GameProperties.Instance.GameOver = false; activeScreen = new StartScreen(_game, _spriteBatch); } }