Пример #1
0
            public void chooseCharacter(ref string character, ref string type, ref int characternum, game g)//Player gets to choose their character
            {
                firetype  a = new firetype("fire");
                watertype b = new watertype("water");
                earthtype c = new earthtype("earth");

                Console.WriteLine("Please choose your character and enter the appropriate number \n 1) {0} - Fire Type \n 2) {1} - Water Type \n 3) {2} - Earth Type"
                                  , a.returnName(), b.returnName(), c.returnName());

                try
                {
                    int number = Convert.ToInt32(Console.ReadLine());

                    switch (number)
                    {
                    case 1:
                        characternum = 1;
                        character    = a.returnName();
                        type         = "fire";
                        break;

                    case 2:
                        characternum = 2;
                        character    = b.returnName();
                        type         = "water";
                        break;

                    case 3:
                        characternum = 3;
                        character    = c.returnName();;
                        type         = "earth";
                        break;

                    default:
                        Console.WriteLine("Try Again");
                        g.chooseCharacter(ref character, ref type, ref characternum, g);
                        break;
                    }
                }
                catch (FormatException)
                {
                    Console.WriteLine("Try Again");
                    g.chooseCharacter(ref character, ref type, ref characternum, g);
                }
            }
Пример #2
0
            public void opponentChar(int opponentNum, ref string oppenentType, ref string opponentName)//sets the details for the opponent's character
            {
                firetype  a = new firetype("fire");
                watertype b = new watertype("water");
                earthtype c = new earthtype("earth");

                switch (opponentNum)
                {
                case 1:
                    opponentName = a.returnName();
                    oppenentType = "fire";
                    break;

                case 2:
                    opponentName = b.returnName();
                    oppenentType = "water";
                    break;

                case 3:
                    opponentName = c.returnName();
                    oppenentType = "earth";
                    break;
                }
            }