Пример #1
0
        private void PlayHand()
        {
            IGameHand hand = new GameHand(
                this.firstToPlay,
                this.firstPlayer,
                this.firstPlayerCards,
                this.secondPlayer,
                this.secondPlayerCards,
                this.state,
                this.deck);

            hand.Start();

            // Update points
            this.UpdatePoints(hand);

            // Update collected cards
            if (hand.Winner == PlayerPosition.FirstPlayer)
            {
                firstPlayerHasCollectedCards = true;
            }
            else
            {
                secondPlayerHasCollectedCards = true;
            }

            this.firstToPlay = hand.Winner;

            // Remove cards
            this.firstPlayerCards.Remove(hand.FirstPlayerCard);
            this.secondPlayerCards.Remove(hand.SecondPlayerCard);


            // Close the game if needed
            if (hand.GameClosedBy == PlayerPosition.FirstPlayer ||
                hand.GameClosedBy == PlayerPosition.SecondPlayer)
            {
                this.gameClosedBy = hand.GameClosedBy;
                this.state.Close();
            }

            // Draw new cards
            this.DrawNewCards();
            // Switch states as necessary
            this.state.PlayHand(this.deck.CardsLeft);
        }
Пример #2
0
        private void PlayHand()
        {
            IGameHand hand = new GameHand(
                this.firstToPlay,
                this.firstPlayer,
                this.firstPlayerCards,
                this.secondPlayer,
                this.secondPlayerCards,
                this.state,
                this.deck);

            hand.Start();

            this.UpdatePoints(hand);

            if (hand.Winner == PlayerPosition.FirstPlayer)
            {
                this.firstPlayerHasCollectedCards = true;
            }
            else
            {
                this.secondPlayerHasCollectedCards = true;
            }

            this.firstToPlay = hand.Winner;

            this.firstPlayerCards.Remove(hand.FirstPlayerCard);
            this.secondPlayerCards.Remove(hand.SecondPlayerCard);

            if (hand.GameClosedBy == PlayerPosition.FirstPlayer ||
                hand.GameClosedBy == PlayerPosition.SecondPlayer)
            {
                this.gameClosedBy = hand.GameClosedBy;
                this.state.Close();
            }

            this.DrawNewCards();
            this.state.PlayHand(this.deck.CardsLeft);
        }
Пример #3
0
        private void PlayHand()
        {
            IGameHand hand = new GameHand(
                this.firstToPlay,
                this.firstPlayer,
                this.firstPlayerCards,
                this.secondPlayer,
                this.secondPlayerCards,
                this.state,
                this.deck);
            hand.Start();

            this.UpdatePoints(hand);

            if (hand.Winner == PlayerPosition.FirstPlayer)
            {
                this.firstPlayerHasCollectedCards = true;
            }
            else
            {
                this.secondPlayerHasCollectedCards = true;
            }

            this.firstToPlay = hand.Winner;

            this.firstPlayerCards.Remove(hand.FirstPlayerCard);
            this.secondPlayerCards.Remove(hand.SecondPlayerCard);

            if (hand.GameClosedBy == PlayerPosition.FirstPlayer
                || hand.GameClosedBy == PlayerPosition.SecondPlayer)
            {
                this.gameClosedBy = hand.GameClosedBy;
                this.state.Close();
            }

            this.DrawNewCards();
            this.state.PlayHand(this.deck.CardsLeft);
        }