Ejemplo n.º 1
0
 public async Task RunState()
 {
     Setup();
     _soundController.PlayNextLevel();
     _hudPanel.SetLevelsCount(_gameContext.LevelNumber + 1);
     _hudPanel.SetPlayerLivesCount(_gameContext.PlayerLives);
     _hudPanel.SetPlayerScore(_gameContext.PlayerScore);
     _hudPanel.SetHighScore(_topPlayersStorage.HighestScore);
     _levelContext.HasWavesToIncome = true;
     await _hudPanel.ShowStageNumber(_gameContext.LevelNumber + 1);
 }
Ejemplo n.º 2
0
        public async Task RunState()
        {
            if (!_gameContext.IsPlayerAlive)
            {
                if (_gameContext.PlayerLives == 0)
                {
                    _levelContext.LevelEndAchieved = true;
                    return;
                }
                else
                {
                    _playerShip.PlaceShipOnScene();
                    _gameContext.TakeOneLife();
                    _hudPanel.SetPlayerLivesCount(_gameContext.PlayerLives);
                }
            }

            if (!_levelContext.LevelEndAchieved)
            {
                await Task.Delay(TimeSpan.FromSeconds(_levelContext.TimeToWait));
            }
        }