private void DrawNextCard() { if (MixedDeck.Cards.Count == 0) { MixedDeck = DiscardPile; MixedDeck.Shuffle(); DiscardPile = new Deck(); } var newCard = MixedDeck.Cards.First(); DiscardPile.Cards.Add(newCard); CurrentCard = newCard; MixedDeck.Cards.RemoveAt(0); if (!newCard.IsValid()) { DrawNextCard(); } }
public void NewGame(Apocalypse apocalypse) { PlayerProfile player = SaveManager.Instance.PlayerProfile; World world = (World)apocalypse.StartupWorld.Clone(); Apocalypse = apocalypse; Player = player; TurnToApocalypse = Apocalypse.TurnToEndAllLifeOnEarth; World = world; DiscardPile = new Deck(); CurrentCard = apocalypse.StartupCard; List <Deck> availableDecks = PrototypeManager.Instance.Decks.Where( d => player.UnlockedDeckNames.Contains(d.Name) && apocalypse.AvailableDeckNames.Contains(d.Name)) .ToList(); MixedDeck = Deck.Merge(availableDecks); MixedDeck.Shuffle(); }