private void Setup() { _shipsFormation.PointsForEnemiesStream .TakeUntilDestroy(_shipsFormation) .Subscribe(points => { var currentScore = _gameContext.AddScore(points); var highestScore = Math.Max(currentScore, _topPlayersStorage.HighestScore); _hudPanel.SetPlayerScore(currentScore); _hudPanel.SetHighScore(highestScore); }); _shipsFormation.LeftEnemiesStream .TakeUntilDestroy(_shipsFormation) .Where(leftEnemies => leftEnemies == 0 && !_levelContext.HasWavesToIncome) .Subscribe(leftEnemies => _levelContext.LevelEndAchieved = true); _playerShip.PlayerShipDestroyedStream .TakeUntilDestroy(_shipsFormation) .Subscribe(_ => { _soundController.PlayFighterDestroyed(); _gameContext.IsPlayerAlive = false; }); }