Exemplo n.º 1
0
        public static void IsPressed(Player _player, ConsoleKeyInfo _info, Random _ran, Dice _diceOne, Dice _diceTwo, Dice _diceThree, Dice _diceFour, Dice _diceFive)
        {
            Console.WriteLine(_player.Name + " please press Enter to throw ...");
            _info = Console.ReadKey();
            if (_info.Key.Equals(ConsoleKey.Enter))
            {
                _diceOne.ThrowDice(_ran);
                _diceTwo.ThrowDice(_ran);
                _diceThree.ThrowDice(_ran);
                _diceFour.ThrowDice(_ran);
                _diceFive.ThrowDice(_ran);

                _diceOne.PrintDice();
                _diceTwo.PrintDice();
                _diceThree.PrintDice();
                _diceFour.PrintDice();
                _diceFive.PrintDice();
            }
        }
Exemplo n.º 2
0
        // Compares Two Dice against each one

        public static void TwoOfSame(ConsoleKeyInfo _info, Random _ran, Dice _diceOne, Dice _diceTwo, Dice _diceThree, Dice _diceFour, Dice _diceFive)
        {
            if ((_diceOne.Die == _diceTwo.Die) && (_diceOne.Die != _diceThree.Die && _diceOne.Die != _diceFour.Die && _diceOne.Die != _diceFive.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the first dice number, " + _diceOne.Die + " equals the second dice number " + _diceTwo.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceOne.ThrowDice(_ran);
                    _diceTwo.ThrowDice(_ran);

                    _diceOne.PrintDice();
                    _diceTwo.PrintDice();

                    return;
                }
            } // done

            if ((_diceOne.Die == _diceFour.Die) && (_diceOne.Die != _diceTwo.Die && _diceOne.Die != _diceThree.Die && _diceOne.Die != _diceFive.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the first dice number, " + _diceOne.Die + " equals the fourth dice number " + _diceFour.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceOne.ThrowDice(_ran);
                    _diceFour.ThrowDice(_ran);

                    _diceOne.PrintDice();
                    _diceFour.PrintDice();

                    return;
                }
            } // done



            if ((_diceOne.Die == _diceFive.Die) && (_diceOne.Die != _diceTwo.Die && _diceOne.Die != _diceThree.Die && _diceOne.Die != _diceFour.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the first dice number, " + _diceOne.Die + " equals the fifth dice number " + _diceFive.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceOne.ThrowDice(_ran);
                    _diceFive.ThrowDice(_ran);

                    _diceOne.PrintDice();
                    _diceFive.PrintDice();

                    return;
                }
            } // done

            if ((_diceTwo.Die == _diceThree.Die) && (_diceTwo.Die != _diceOne.Die && _diceTwo.Die != _diceFour.Die && _diceTwo.Die != _diceFive.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the second dice number, " + _diceTwo.Die + " equals the third dice number " + _diceThree.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceTwo.ThrowDice(_ran);
                    _diceThree.ThrowDice(_ran);

                    _diceTwo.PrintDice();
                    _diceThree.PrintDice();

                    return;
                }
            } // done

            if ((_diceTwo.Die == _diceFour.Die) && (_diceTwo.Die != _diceOne.Die && _diceTwo.Die != _diceThree.Die && _diceTwo.Die != _diceFive.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the second dice number, " + _diceTwo.Die + " equals the fourth dice number " + _diceFour.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceTwo.ThrowDice(_ran);
                    _diceFour.ThrowDice(_ran);

                    _diceTwo.PrintDice();
                    _diceFour.PrintDice();

                    return;
                }
            } // done

            if ((_diceTwo.Die == _diceFive.Die) && (_diceTwo.Die != _diceOne.Die && _diceTwo.Die != _diceThree.Die && _diceTwo.Die != _diceFour.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the second dice number, " + _diceTwo.Die + " equals the fifth dice number " + _diceFive.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceTwo.ThrowDice(_ran);
                    _diceFive.ThrowDice(_ran);

                    _diceTwo.PrintDice();
                    _diceFive.PrintDice();

                    return;
                }
            } // done

            if ((_diceThree.Die == _diceOne.Die) && (_diceThree.Die != _diceTwo.Die && _diceThree.Die != _diceFour.Die && _diceThree.Die != _diceFive.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the third dice number, " + _diceThree.Die + " equals the first dice number " + _diceOne.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceThree.ThrowDice(_ran);
                    _diceOne.ThrowDice(_ran);

                    _diceThree.PrintDice();
                    _diceOne.PrintDice();

                    return;
                }
            } // done

            if ((_diceThree.Die == _diceFour.Die) && (_diceThree.Die != _diceOne.Die && _diceThree.Die != _diceTwo.Die && _diceThree.Die != _diceFive.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the third dice number, " + _diceThree.Die + " equals the Fourth dice number " + _diceFour.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceThree.ThrowDice(_ran);
                    _diceFour.ThrowDice(_ran);

                    _diceThree.PrintDice();
                    _diceFour.PrintDice();

                    return;
                }
            } // done

            if ((_diceThree.Die == _diceFive.Die) && (_diceThree.Die != _diceOne.Die && _diceThree.Die != _diceTwo.Die && _diceThree.Die != _diceFour.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the third dice number, " + _diceThree.Die + " equals the fifth dice number " + _diceFive.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceThree.ThrowDice(_ran);
                    _diceFive.ThrowDice(_ran);

                    _diceThree.PrintDice();
                    _diceFive.PrintDice();

                    return;
                }
            } // done

            if ((_diceFour.Die == _diceFive.Die) && (_diceFour.Die != _diceOne.Die && _diceFour.Die != _diceTwo.Die && _diceFour.Die != _diceThree.Die))
            {
                Console.WriteLine("Please roll again by pressing Enter as the fourth dice number, " + _diceFour.Die + " equals the fifth dice number " + _diceFive.Die + " ...");
                _info = Console.ReadKey();
                if (_info.Key.Equals(ConsoleKey.Enter))
                {
                    _diceFour.ThrowDice(_ran);
                    _diceFive.ThrowDice(_ran);

                    _diceFour.PrintDice();
                    _diceFive.PrintDice();

                    return;
                }
            } // done
        }     // done