private void OnNewScoreReached(int score) { var levelSettings = GetMatchingPreset(score); if (_currentPreset.Id != levelSettings.Id) { _currentPreset = levelSettings; ReloadLevelSettings(_currentPreset); } }
private void ReloadLevelSettings(ChunkPresets preset) { _maxChunksWithoutAmmoRefill = preset.MaxChunksWithoutAmmoRefill; _chunkSchemes = preset.Chunks; _ammoRefillProbability = preset.AmmoRefillProbability; _jetpackProbability = preset.JetpackProbability; _gapBetweenChunks = preset.GapBetweenChunks; _schemeQueue.Clear(); _shuffledSchemes.Clear(); FillListWithChunks(); }
private void Start() { _isInTutorial = !HPlayerPrefs.GetBool(GameplayController.TutorialPassedKey); GameplayController.GameStarted.AddListener(Setup); GameplayController.GameContinuedAfterRestart.AddListener(SetupAfterRestart); GameplayController.GameRestarted.AddListener(OnGameRestart); GameplayController.NewScoreReached.AddListener(OnNewScoreReached); _chunkPresets = ChunkController.Instance.ChunkPresets.ChunkPresets; _schemeQueue = new Queue <ChunkScheme>(); _shuffledSchemes = new List <ChunkScheme>(); _currentPreset = GetMatchingPreset(0); ReloadLevelSettings(_currentPreset); }