public void Handle(string[] fullCommand) { Console.Clear(); Prepare(); _difficulty = DifficultyStats.Create((Difficulty)SelectDifficulty()); Console.CursorVisible = false; Console.Clear(); // Create some enemies. CreateEnemies(); // Draw the Spaceship _spaceShip.Draw(); // Prepare reset event _gameOver = new ManualResetEvent(false); // Start reading the keybord for movements _cycleTimer = new Timer(ReadInput, null, 0, 30); // Start the movement timer. _moveElementsTimer = new Timer(MoveAllElements, null, 100, 100); // Wait for game to finish _gameOver.WaitOne(); Console.Clear(); Console.WriteLine("Your Score: " + _score); Console.WriteLine("Game Over"); Console.CursorVisible = true; Console.ReadLine(); Console.Clear(); }
internal static DifficultyStats Create(Difficulty difficulty) { DifficultyStats instance; switch (difficulty) { case Difficulty.Medium: instance = new DifficultyStats { FireFireFrequenceOfEnemy = 925, MoveEnemySpeed = 95, NumberOfBulletsAtTheSameTimeFromEnemy = 7, ScoreValue = new[] { 250, 350, 700 }, BulletsForSpaceShip = 4, }; break; case Difficulty.Hard: instance = new DifficultyStats { FireFireFrequenceOfEnemy = 900, MoveEnemySpeed = 90, NumberOfBulletsAtTheSameTimeFromEnemy = 9, ScoreValue = new[] { 500, 800, 1250 }, BulletsForSpaceShip = 3, }; break; case Difficulty.PainInTheA: instance = new DifficultyStats { FireFireFrequenceOfEnemy = 200, MoveEnemySpeed = 20, NumberOfBulletsAtTheSameTimeFromEnemy = 50, ScoreValue = new[] { 1250, 1900, 2590 }, BulletsForSpaceShip = 4, }; break; case Difficulty.Easy: // Left for readability default: instance = new DifficultyStats { FireFireFrequenceOfEnemy = 950, MoveEnemySpeed = 100, NumberOfBulletsAtTheSameTimeFromEnemy = 5, ScoreValue = new[] { 150, 250, 500 }, BulletsForSpaceShip = 5, }; break; } return instance; }
private void _difficultyControl_didSelectCellEvent(int arg2) { if (_selectedSong != null && _selectedSong.beatmapLevelData != null && _selectedSong.beatmapLevelData.difficultyBeatmapSets != null) { IDifficultyBeatmap beatmap = _selectedSong.beatmapLevelData.difficultyBeatmapSets.First(x => x.beatmapCharacteristic == selectedCharacteristic).difficultyBeatmaps[arg2]; selectedDifficulty = beatmap.difficulty; _blocksParamText.text = beatmap.beatmapData.notesCount.ToString(); _obstaclesParamText.text = beatmap.beatmapData.obstaclesCount.ToString(); if (ScrappedData.Downloaded) { ScrappedSong scrappedSong = ScrappedData.Songs.FirstOrDefault(x => x.Hash == SongCore.Collections.hashForLevelID(_selectedSong.levelID)); if (scrappedSong != default) { DifficultyStats stats = scrappedSong.Diffs.FirstOrDefault(x => x.Diff == selectedDifficulty.ToString().Replace("+", "Plus")); if (stats != default) { _starsParamText.text = stats.Stars.ToString(); _rankedText.text = $"<color={(stats.Ranked == 0 ? "red" : "green")}>{(stats.Ranked == 0 ? "UNRANKED" : "RANKED")}</color>"; } else { _starsParamText.text = "--"; _rankedText.text = $"<color=red>UNRANKED</color>"; } long votes = scrappedSong.Upvotes - scrappedSong.Downvotes; _ratingParamText.text = (votes < 0 ? votes.ToString() : $"+{votes}"); } else { _starsParamText.text = "--"; _ratingParamText.text = "--"; _rankedText.text = "<color=yellow>SONG NOT FOUND</color>"; } } else { _starsParamText.text = "--"; _ratingParamText.text = "--"; _rankedText.text = "<color=yellow>SONG NOT FOUND</color>"; } levelOptionsChanged?.Invoke(); } }
public void UpdateContent() { if (_selectedLevel != null) { songNameText.text = _selectedLevel.songName; durationText.text = _selectedLevel.beatmapLevelData.audioClip.length.MinSecDurationText(); bpmText.text = Mathf.RoundToInt(_selectedLevel.beatsPerMinute).ToString(); if (_selectedDifficultyBeatmap != null) { npsText.text = (_selectedDifficultyBeatmap.beatmapData.notesCount / _selectedLevel.beatmapLevelData.audioClip.length).ToString("0.00"); notesCountText.text = _selectedDifficultyBeatmap.beatmapData.notesCount.ToString(); obstaclesCountText.text = _selectedDifficultyBeatmap.beatmapData.obstaclesCount.ToString(); bombsCountText.text = _selectedDifficultyBeatmap.beatmapData.bombsCount.ToString(); var playerLevelStats = _playerDataModel.playerData.GetPlayerLevelStatsData(_selectedDifficultyBeatmap); if (playerLevelStats.validScore) { maxComboValue.text = playerLevelStats.maxCombo.ToString(); highscoreValue.text = playerLevelStats.highScore.ToString(); maxRankValue.text = playerLevelStats.maxRank.ToString(); } else { maxComboValue.text = "--"; highscoreValue.text = "--"; maxRankValue.text = "--"; } string levelHash = SongCore.Collections.hashForLevelID(_selectedLevel.levelID); ScrappedSong scrappedSongData = ScrappedData.Songs.FirstOrDefault(x => x.Hash == levelHash); if (scrappedSongData != default) { DifficultyStats stats = scrappedSongData.Diffs.FirstOrDefault(x => x.Diff == selectedDifficulty.ToString().Replace("+", "Plus")); if (stats != default) { starsText.text = stats.Stars.ToString(); rankingValue.text = $"<color={(stats.Ranked == 0 ? "red" : "green")}>{(stats.Ranked == 0 ? "UNRANKED" : "RANKED")}</color>"; } else { starsText.text = (stats.Stars > float.Epsilon) ? stats.Stars.ToString() : "--"; rankingValue.text = $"<color=red>UNRANKED</color>"; } long votes = scrappedSongData.Upvotes - scrappedSongData.Downvotes; ratingText.text = (votes < 0 ? votes.ToString() : $"+{votes}"); } else { rankingValue.text = $"<color=yellow>NOT FOUND</color>"; starsText.text = "--"; ratingText.text = "--"; } } else { npsText.text = "--"; notesCountText.text = "--"; obstaclesCountText.text = "--"; bombsCountText.text = "--"; maxComboValue.text = "--"; highscoreValue.text = "--"; maxRankValue.text = "--"; rankingValue.text = "--"; starsText.text = "--"; ratingText.text = "--"; } } }