Exemple #1
0
 public void AddCardToHand(Card crd, PokerPlayer player)
 {
     for (int i = 0; i < heldCards.Count; ++i)
     {
         if (heldCards[i] == null)
         {
             CardInHand card = cardPlaceholders[i].GetComponent <CardInHand>();
             card.SetCard(crd, player);
             heldCards[i] = card;
             break;
         }
     }
 }
Exemple #2
0
        public void RemoveCard(CardInHand inHand)
        {
            if (!heldCards.Contains(inHand))
            {
                Debug.LogError("HandVisualizer.RemoveCard()::Error removing card from heldCards.");
                return;
            }

            int i = heldCards.IndexOf(inHand);

            heldCards[i] = null;
            if (inHand != null)
            {
                inHand.NullifyCard();
            }
        }
Exemple #3
0
        /// <summary>
        /// Return false when too many cards selected. Otherwise adds card too throwaway list and returns true.
        /// </summary>
        /// <param name="cardInHand"></param>
        /// <returns>false when too many cards selected</returns>
        public bool SetCardSelected(CardInHand cardInHand)
        {
            if (cardsSelected.Count >= pokerRules.MaxCardDrawAmount)
            {
                return(false);
            }

            int cardCount = cardsSelected.Count;

            if (deck.InsufficientCards(cardCount))
            {
                Debug.Log("Not enough cards left in deck!");
                return(false);
            }

            cardsSelected.Add(cardInHand);
            return(true);
        }