/// <summary> /// Deal a card. /// </summary> /// <param name="player"></param> public void DealCard(Player player, Form form = null) { // Get the first card on the top of the deck. Assign to drawnCard. PlayingCard drawnCard = MyDeck.GetCard(0); // Remove this card from the deck. MyDeck.RemoveCard(drawnCard); if (player.GetType() != typeof(Computer)) //check if the given player is not a computer { drawnCard.FlipCard(); //flip the drawnCard } if (form != null) //check if form is not null { player.Add(drawnCard, form); //add card to given players hand passing along given form } else //form is null { player.Add(drawnCard); //add card to given players hand } SoundPlayer audio = new SoundPlayer(CardGameLibrary.Properties.Resources.flip_sound); //create new soundplayer for the card flip sound audio.PlaySync(); //play the card flip sound on same thread haulting program }
/// <summary> /// Method for selecting the trump of the game /// </summary> /// <returns></returns> public PlayingCard SelectTrumpCard() { PlayingCard drawnCard = MyDeck.GetCard(0); // Get the first card on the top of the deck. Assign to drawnCard. MyDeck.RemoveCard(drawnCard); // Remove this card from the deck. drawnCard.FlipCard(); // Flip drawnCard. SoundPlayer audio = new SoundPlayer(CardGameLibrary.Properties.Resources.flip_sound); //create new soundplayer for the card flip sound audio.PlaySync(); //play the card flip sound on same thread haulting program return(drawnCard); //return trump card }