Decks & Dealer¶
CardDeck¶
CardDeck stores Card Definition references and validates:
- Maximum deck size
- Maximum copies of one card
- Empty card entries
Important methods:
deck.TryAddCard(card);
deck.RemoveCard(card);
deck.CountCopies(card);
deck.IsValid(out string message);
deck.Clear();
CardDealerManager¶
The dealer copies the CardDeck into a private runtime draw pile. Drawing never removes cards from the asset.
Inspector setup:
| Field | Value |
|---|---|
| Deck | The CardDeck asset |
| Shuffle On Start | Shuffle the runtime pile |
| Card Prefab | ModularCardBase |
| Card Holder | Object containing UIHandLayout |
| Card Count | Opening hand size |
Drawing¶
dealer.DrawCard();
dealer.DrawCards(3);
if (dealer.TryDrawCard(out ModularCardView cardView))
{
// The card was created successfully.
}
Use RemainingCards to display the current draw-pile count.
Events¶
On Card Drawn(CardDefinition)On Deck Empty
Warning
Keep the reusable prefab's Design Override empty. A filled override forces every dealt card to use the same theme.