コード例 #1
0
ファイル: Uno.cs プロジェクト: NikitaBeloshapka/Uno-last
        public void Start()
        {
            CommonDeck.Mix();

            foreach (var player in Players)
            {
                player.Cards.Add(CommonDeck.Deal(7));
            }

            DeckCard     = CommonDeck.Pull();
            activeColor  = DeckCard.Colour;
            Reversed     = false;
            activePlayer = Players[0];
            SelectPlayer(activePlayer);
            SelectCards(GetCardsForMoving(), activePlayer);
        }
コード例 #2
0
ファイル: Uno.cs プロジェクト: NikitaBeloshapka/Uno-last
        public void Move(Card card, CardColour colour)
        {
            if (activePlayer.Cards.Cards.IndexOf(card) == -1)
            {
                Fail("ActivePlayer don't have this card");
                return;
            }

            if (!IsCorrect(DeckCard, card))
            {
                Fail("This card can't been put now");
                return;
            }

            DeckCard = card;
            activePlayer.Cards.Cards.Remove(card);
            activeColor = colour;

            if (DeckCard.Kinds == KindsOfCards.reverse)
            {
                Reversed = !Reversed;
            }

            if (DeckCard.Kinds == KindsOfCards.add2)
            {
                NextPlayer(activePlayer).Cards.Add(CommonDeck.Deal(2));
            }

            giveMove     = false;
            activePlayer = DeckCard.Kinds == KindsOfCards.skip ?
                           NextPlayer(NextPlayer(activePlayer)) :
                           NextPlayer(activePlayer);
            SelectPlayer(activePlayer);

            Refresh();
        }