Esempio n. 1
0
        public void NextRoud()
        {
            Console.Clear();

            bool completeRound = false;

            while (!completeRound && players[0].playerState != player.State.DONE)
            {
                Console.Clear();

                Console.WriteLine($"current Deck: {currentDeck.Count}");
                Console.WriteLine($"Played deck: {playedDeck.Count}");

                Console.WriteLine("");
                Console.WriteLine("");
                playedDeck[playedDeck.Count - 1].showCard();
                Console.WriteLine("");
                Console.WriteLine("");

                string playerChoiceString = players[0].playerAction(); //Returns the player chooses and want play

                //If the player can stack more cards then a system will detect it and will limit the cards

                if (playerChoiceString.ToLower() == "p") //Checks if player can picks up cards
                {
                    givPlayerCards(1, 0);
                }
                else if (playerChoiceString.ToLower() == "u")
                {
                    players[0].setUNO();
                }
                else if (playerChoiceString.ToLower() == "d" && ActionDeck.Count > 0) //Checks if player can end the round
                {
                    putPlayerLastInList();


                    for (int i = 0; i < ActionDeck.Count; i++)
                    {
                        cardAction(ActionDeck[i]);
                    }
                    ActionDeck.Clear();

                    completeRound = true;
                    stackCard     = false;
                }
                else if (int.TryParse(playerChoiceString, out int playerChoiceInt)) //Checks if player have choose a number
                {
                    processingRound(playerChoiceInt);
                }
                else //Player have to play a card or an option
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("You have to play a card before you can end the round");
                    Console.ForegroundColor = ConsoleColor.White;
                    Thread.Sleep(1100);
                }
            }
        }
Esempio n. 2
0
        void moveCards(int playerChoiceInt) //Moving the cards around to the lists
        {
            if (players[0].playerState == player.State.ACTIVE && players[0].playerCards.Count == 1)
            {
                Console.WriteLine("");
                Console.WriteLine("");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("You forgot to call UNO");
                Console.WriteLine("Have fun with your new card");
                Console.ForegroundColor = ConsoleColor.White;
                Thread.Sleep(1100);


                givPlayerCards(1, 0);
                putPlayerLastInList();
            }
            else
            {
                playedDeck.Add(players[0].playerCards[playerChoiceInt]);

                ActionDeck.Add(players[0].playerCards[playerChoiceInt]);

                currentCard = playedDeck[playedDeck.Count - 1];

                players[0].removeCard(players[0].playerCards[playerChoiceInt]);
            }

            if (players[0].playerCards.Count == 0 && players[0].playerState == player.State.UNO)
            {
                players[0].playerState = player.State.DONE;

                if (winner == null)
                {
                    winner = players[0];
                }
            }
        }