Beispiel #1
0
        public void battleMode(Dinosaur dinosaur, Robot robot)
        {
            int num1 = 2;

            while (dinosaur.dinoHealth > 0 && robot.robotHealth > 0)
            {
                num1++;
                if (num1 % 2 == 0)
                {
                    Console.WriteLine(robot.robotName + " is attacking " + weapon.weaponsAttack());
                    robot.roboWeaponAttack(dinosaur);
                    Console.WriteLine(dinosaur.dinoName + " health level: " + dinosaur.dinoHealth);
                    Console.WriteLine("to atttack press ENTER");
                    Console.ReadLine();
                }
                else
                {
                    Console.WriteLine(dinosaur.dinoName + " is attacking: " + weapon.weaponsAttack());
                    dinosaur.dinoAttack(robot);
                    Console.WriteLine(robot.robotName + " health level: " + robot.robotHealth);
                    Console.WriteLine("to atttack press ENTER");
                    Console.ReadLine();
                }
            }

            if (robot.robotHealth > dinosaur.dinoHealth)
            {
                Console.WriteLine(robot.robotName + " Wins!!!");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine(dinosaur.dinoName + " Wins!!!");
                Console.ReadLine();
            }
            Console.WriteLine("Game Over, Thank you for playing");
            Console.WriteLine("Would you like to play again?");
            gameInit();
        }
Beispiel #2
0
 public void dinoAttack(Robot robot)
 {
     robot.robotHealth -= weapon.weaponsAttack();
 }
Beispiel #3
0
 public void roboWeaponAttack(Dinosaur dinosaur)
 {
     dinosaur.dinoHealth -= weapon.weaponsAttack();
 }