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(); }
public void dinoAttack(Robot robot) { robot.robotHealth -= weapon.weaponsAttack(); }
public void roboWeaponAttack(Dinosaur dinosaur) { dinosaur.dinoHealth -= weapon.weaponsAttack(); }