public void Update(double elapsedTime) { _level.Update(elapsedTime, _gameTime); _gameTime -= elapsedTime; if (_gameTime <= 0) { OnGameStart(); _gameData.JustWon = true; _system.ChangeState("game_over"); } if (_level.HasPlayerDied()) { OnGameStart(); _gameData.JustWon = false; _system.ChangeState("game_over"); } }
public void Update(double elapsedTime) { _lvlTitleTime -= elapsedTime; if (_lvlTitleTime < 0) { _gameTime += elapsedTime; _level.Update(elapsedTime, _gameTime); _score.Update(_gameData.Score); _lives.Update(_gameData.Lives); //if (_gameTime < 0) if (_level.Finished) { if (_gameData.CurrentLevel.NextLevel != null && _gameData.CurrentLevel.NextLevel != string.Empty) { _gameData.NewGame = false; _gameData.CurrentLevel = _levelManager.Load(_gameData.CurrentLevel.NextLevel); } else { _gameData.JustWon = true; _gameData.NewGame = true; _gameData.CurrentLevel = _levelManager.Load("Level_1"); UpdateHighScore(_gameData.Score); _system.ChangeState("game_over"); } OnGameStart(); } if (_level.HasPlayerDied()) { _gameData.JustWon = false; _gameData.NewGame = true; _gameData.CurrentLevel = _levelManager.Load("Level_1"); OnGameStart(); _system.ChangeState("game_over"); } } }