private void PickupNextCard(Choice choice = null) { Card card = null; // Tutorial for first time players. if (!_tutorialDone && choice == null) { Debug.Log("Doing tutorial."); card = _tutorialCard; _tutorialInProgress = true; _tutorialDone = true; PlayerPrefs.SetInt(TUTORIAL_DONE_PREF, 1); } // If the game started, pickup the title card. if (_launchedGame && !_tutorialInProgress) { Debug.Log("Showing title card."); card = _titleCard; _launchedGame = false; } // Check for stats at zero. if (_gameEnded == false) { if (_energy <= -100) { card = _noEnergyCard; } if (_happiness <= -100) { card = _noHapinessCard; } if (_productivity <= -100) { card = _noProductivityCard; } if (card != null && card != _titleCard && card != _creditsCard && !_tutorialInProgress) { _gameEnded = true; Debug.Log($"One of your stats has gotten to low. Your stats: Happiness ({_happiness}), Productivity ({_productivity}), Energy ({_energy})"); AudioService.Instance.PlayLose(); _cardPool.ClearCardPool(); } } // Check for a forced card. if (card == null) { Card forcedCard = _cardPool.MostRecentDeck.GetForcedCard(_currentDeckIndex, _currentCard); if (forcedCard != null && !_forcedCards.Contains(forcedCard)) { card = forcedCard; _forcedCards.Add(forcedCard); } } // Check for followup card. if (card == null && choice != null) { card = choice.GetFollowupCard(); } // Get random card. if (card == null) { card = _cardPool.PickupRandomCard(_currentTimeOfDay, new Stats(_energy, _happiness, _productivity)); } // No more cards left avaliable. if (card == null) { if (!_gameEnded) { _gameEnded = true; card = _endGameCard; AudioService.Instance.PlayWin(); Debug.Log("No more cards avaliable to pickup."); _cardPool.ClearCardPool(); } else { Debug.Log("Game over."); card = _creditsCard; } } // Execute card effectgs. CardEffects(card); // Draw the card _cardUi.DrawCard(card); _cardTextUi.DrawCard(card); _currentCard = card; }