Ejemplo n.º 1
0
        /// <summary>
        /// Add new deck
        /// </summary>
        public void AddDeck()
        {
            DeckCommands deck = new DeckCommands();

            decks.Add(deck);
            ShuffleDecks();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deal card, if deck is empty go to next deck
        /// </summary>
        /// <returns></returns>
        public Card DealCard()
        {
            Card card = new Card();

            DeckCommands deck = GetNextDeck();

            if (deck.GetCardsLeftInDeck() > 0)
            {
                card = deck.GetCard();
            }

            return(card);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deal a hidden card
        /// </summary>
        /// <returns></returns>
        public Card DealHiddenCard()
        {
            Card card = new Card();

            DeckCommands deck = GetNextDeck();

            if (deck.GetCardsLeftInDeck() > 0)
            {
                card          = deck.GetCard();
                card.HideCard = true;
            }

            return(card);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get next deck
        /// </summary>
        /// <returns></returns>
        private DeckCommands GetNextDeck()
        {
            DeckCommands deck = new DeckCommands();

            if (decks.FirstOrDefault().GetCardsLeftInDeck() == 0)
            {
                decks.Remove(decks.FirstOrDefault());
                AddDeck();
                deck = decks.FirstOrDefault();
            }
            else
            {
                deck = decks.FirstOrDefault();
            }
            return(deck);
        }