/// <summary> /// This is called when a door is taken within a regular turn: /// If the player has a key in the corresponding color he is able to play this key to obtain the card or put the card on the limbus. /// if the player chooses to play a Door te index of the propper key wihtin the hand is returned /// </summary> /// <param name="door">The door, which has to be handled</param> private int handleDoor(GameCard door) { int index = -1; for (int i = 0; i < hand.CardsOnHand.Count; i++) { if ((hand.CardsOnHand[i].isKey()) && (door.CardColor == hand.CardsOnHand[i].CardColor)) { index = i; break; } } if (index != -1) { //Propper key found. Show Dialog to ask user whether to use Key for door aquisition or not //By default say yes } return index; }
public void addCardToHand(GameCard card) { if (this.cardsOnHand.Count>=handLimit) throw new Exception("Hand-Limit reached"); this.cardsOnHand.Add(card); }