Example #1
0
    private IEnumerator PlayTrick()
    {
        currentTrick  = new Trick(numPlayers, trumpCard.GetSuit());
        currentPlayer = currentLeader;

        while (!currentTrick.IsComplete())
        {
            if (gm.IsHeadRound())
            {
                yield return(PlayHeadCard());
            }
            else
            {
                yield return(PlayCard());
            }
        }

        yield return(gm.WaitForMovingCards());

        Debug.Log(currentTrick.GetWinningPlayer().GetName() + " has won this trick!");

        yield return(gm.AwardTrick(currentTrick.GetWinningPlayer()));

        tricksAwarded++;
        currentLeader = currentTrick.GetWinningPlayer();
    }
Example #2
0
        public void TrumpInGetWinningPlayerTest()
        {
            var trick = new Trick(new Hand(Players, Deck)
            {
                SpadesHaveBeenBroken = true
            });

            trick.PlayCard(PlayerOne, new Card()
            {
                Rank = Rank.Seven, Suit = Suit.Diamonds
            });
            trick.PlayCard(PlayerTwo, new Card()
            {
                Rank = Rank.Ten, Suit = Suit.Diamonds
            });
            trick.PlayCard(PlayerThree, new Card()
            {
                Rank = Rank.Two, Suit = Suit.Spades
            });
            trick.PlayCard(PlayerFour, new Card()
            {
                Rank = Rank.Nine, Suit = Suit.Diamonds
            });

            var winner = trick.GetWinningPlayer();

            Assert.AreEqual(PlayerThree, winner);
        }
Example #3
0
        public void AllTrumpsGetWinningPlayerTest()
        {
            var trick = new Trick(new Hand(Players, Deck)
            {
                SpadesHaveBeenBroken = true
            });

            trick.PlayCard(PlayerTwo, new Card()
            {
                Rank = Rank.King, Suit = Suit.Spades
            });
            trick.PlayCard(PlayerThree, new Card()
            {
                Rank = Rank.Queen, Suit = Suit.Spades
            });
            trick.PlayCard(PlayerFour, new Card()
            {
                Rank = Rank.Jack, Suit = Suit.Spades
            });
            trick.PlayCard(PlayerOne, new Card()
            {
                Rank = Rank.Ace, Suit = Suit.Spades
            });

            var winner = trick.GetWinningPlayer();

            Assert.AreEqual(PlayerOne, winner);
        }