public static List <string> Userfood = new List <string>(); // creating list of food static void Main(string[] args) { // creating objects TestGame progobj = new TestGame(); Setup setupobj = new Setup(); Outside outsideobj = new Outside(); House houseobj = new House(); Level1 lvl1obj = new Level1(); Level2 lvl2obj = new Level2(); Creature creatureobj = new Creature(); Creature creature2obj = new Creature(); Config configobj = new Config(); houseobj.randomfood = new Random(); houseobj.outsideobj = outsideobj; CokeMan cokeobj = new CokeMan(3); PepsiMan pepsiobj = new PepsiMan(5); Level3 lvl3obj = new Level3(); // calling the methods setupobj.GetName(); setupobj.AskUser(); setupobj.UserFoodInput(); setupobj.Intro(); outsideobj.OutsideHouse(); creatureobj.feet = setupobj.GetUserNums; creatureobj.AnimalGreeting(); creatureobj.ChooseStatement(); outsideobj.DifferentDoors(); houseobj.setupobj = setupobj; houseobj.GetLastName(); houseobj.HouseLevel(); // create 5 same methods for the 5 different rooms houseobj.ChooseDoor(); if (configobj.DiceMethod() == true) { Level1.Basement(); } else { configobj.GameEnd(); } lvl1obj.FirstArea(); lvl1obj.FirstArea2(); lvl1obj.FirstArea3(); lvl2obj.WhichMonster(); lvl3obj.Lvl3(); }
public void WhichMonster() { morediceroll.Next(1, 3); // created a diceroll from 1 to 2 if (morediceroll.Next(1, 3) == 2) // if player rolls 2, he encounters PepsiMan otherwise CokeMan { PepsiMan sodaobj = new PepsiMan(5); // Polymorphism Console.WriteLine("The Buddha figure has teleported you to a wrestling ring. You have encountered a can with a Pepsi on it."); Console.Write("What would you like to do to it? (C)lothesline (T)ouch (S)uplex (Q)uit: "); string choosemove = Console.ReadLine().ToUpper(); while (choosemove != "C" && choosemove != "Q" && choosemove != "T" && choosemove != "S") { Console.Write("What would you like to do to it? (C)lothesline (T)ouch (S)uplex (Q)uit: "); choosemove = Console.ReadLine().ToUpper(); } switch (choosemove) { case "C": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You decided to clothesline the PepsiMan can and you ruined his dreams of becoming the sodaweight champion."); Console.ResetColor(); fanta.Bite(); break; case "T": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You decided to touch the PepsiMan."); sodaobj.Attack(); // calls the attack method for pepsiman Console.ResetColor(); fanta.Bite(); break; case "S": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You decided to suplex the PepsiMan can and you ruined his dreams of becoming the sodaweight champion. "); Console.ResetColor(); fanta.Bite(); break; case "Q": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; configobj.GameEnd(); Console.ResetColor(); break; } } else { CokeMan sodaobj = new CokeMan(3); // Polymorphism Console.WriteLine("The Buddha figure has teleported you to a wrestling ring. You have encountered a can with a Coke on it."); Console.Write("What would you like to do to it? (C)lothesline (T)ouch (S)uplex (Q)uit: "); string choosemove = Console.ReadLine().ToUpper(); while (choosemove != "C" && choosemove != "Q" && choosemove != "T" && choosemove != "S") { Console.Write("What would you like to do to it? (C)lothesline (T)ouch (S)uplex (Q)uit: "); choosemove = Console.ReadLine().ToUpper(); } switch (choosemove) { case "C": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You decided to clothesline the CokeMan can and you ruined his dreams of becoming the sodaweight champion."); Console.ResetColor(); fanta.Bite(); break; case "T": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You decided to touch the CokeMan."); sodaobj.Attack(); // calls the attack method for cokeman Console.ResetColor(); fanta.Bite(); break; case "S": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You decided to suplex the CokeMan can and you ruined his dreams of becoming the sodaweight champion. "); Console.ResetColor(); fanta.Bite(); break; case "Q": Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; configobj.GameEnd(); Console.ResetColor(); break; } } }