Пример #1
0
 public PlayerHand(Card[] cards)
 {
     foreach(var card in cards)
     {
         if (card is CardSecretRole)
             if (Role != null)
                 throw new ArgumentException("Multiple secret role cards!", nameof(cards));
             else
                 Role = card as CardSecretRole;
         else if (card is CardMembership)
             if (Membership != null)
                 throw new ArgumentException("Multiple membership cards!", nameof(cards));
             else
                 Membership = card as CardMembership;
         else if (card is CardBallotYes)
             Yes = card as CardBallotYes;
         else if (card is CardBallotNo)
             No = card as CardBallotNo;
     }
     if (Role == null)
         throw new ArgumentException("Missing a secret role card!", nameof(cards));
     if (Membership == null)
         throw new ArgumentException("Missing a membership card!", nameof(cards));
     if (Yes == null)
         Yes = new CardBallotYes();
     if (No == null)
         No = new CardBallotNo();
 }
Пример #2
0
 public PlayerHand(CardSecretRole role, CardMembership membership, bool flipped = false)
 {
     Role = role;
     Membership = membership;
     Yes = new CardBallotYes() { Flipped = flipped };
     No = new CardBallotNo() { Flipped = flipped };
 }