private static void HandleGameModePlayTracked(GameMode gameMode) { int totalTrackedPlayCount = TotalTrackedPlayCount(); bool shouldUnlock = totalTrackedPlayCount >= kUnlockAfterPlays; if (!shouldUnlock) { return; } var lockedGameModes = GameConstants.Instance.GameModes.Where(mode => !UnlockedData_.IsUnlocked(mode.Id)).ToArray(); if (lockedGameModes.Length <= 0) { return; } GameMode unlockedMode = lockedGameModes.Random(); Unlock(unlockedMode); GameModesPlayedTracker.Reset(); BattleState.QueuedGameMode = unlockedMode; }
private static int TotalTrackedPlayCount() { return(GameConstants.Instance.GameModes.Sum(mode => GameModesPlayedTracker.GetPlayedCountFor(mode))); }