public void Menu() { string choice = ""; while (choice != "0") { //Display menu Console.WriteLine("\nMenu"); Console.WriteLine("0: Exit"); Console.WriteLine("1: Equip Weapon"); Console.WriteLine("2: Uneqip Weapon"); Console.WriteLine("3: Equip Armor"); Console.WriteLine("4: Unequip Armor"); Console.WriteLine("5: Add Gold"); Console.WriteLine("6: Subtract Gold"); //Get input choice = Console.ReadLine(); Console.WriteLine(""); //Check input if (choice == "1") { equipWeapon(); // Update total weight _weightTotal = _weightFromArmor + _weightFromWeapon; Console.WriteLine("Damage: " + _damage + " Weight: " + _weightTotal); } else if (choice == "2") { unequipWeapon(); // Update total weight _weightTotal = _weightFromArmor + _weightFromWeapon; Console.WriteLine("Damage: " + _damage + " Weight: " + _weightTotal); } else if (choice == "3") { equipArmor(); // Update total weight _weightTotal = _weightFromArmor + _weightFromWeapon; CurrentArmor.Print(); } else if (choice == "4") { unequipArmor(); // Update total weight _weightTotal = _weightFromArmor + _weightFromWeapon; CurrentArmor.Print(); } else if (choice == "5") { Console.Write("How much gold?"); float addedGold = Convert.ToSingle(Console.ReadLine()); addGold(addedGold); } else if (choice == "6") { Console.Write("How much gold?"); float addedGold = Convert.ToSingle(Console.ReadLine()); subtractGold(addedGold); } } }
//armor System // Displays a menu that allows the player to pick from a list of available armor // Sets the current Armor to the armor the player selected public void equipArmor() { string menu3 = ""; if (!_hasArmor) { while (menu3 != "0") { Console.WriteLine("\nArmor list"); Console.WriteLine("0: Back"); Console.WriteLine("1: Leather"); Console.WriteLine("2: Iron"); Console.WriteLine("3: Steel"); Console.WriteLine("4: Platnium"); string choice2 = ""; choice2 = Console.ReadLine(); Console.WriteLine(""); if (choice2 == "0") { menu3 = "0"; } else if (choice2 == "1") { if (checkWeight(_weightFromWeapon, 15)) { Console.WriteLine("Equipped Leather tunic."); CurrentArmor = _armor[0]; CurrentArmor.Print(); _hasArmor = true; menu3 = "0"; } else { Console.WriteLine("Weight limit reached"); } } else if (choice2 == "2") { if (checkWeight(_weightFromWeapon, 20)) { Console.WriteLine("Equipped Iron armor."); CurrentArmor = _armor[1]; CurrentArmor.Print(); _hasArmor = true; menu3 = "0"; } else { Console.WriteLine("Weight limit reached"); } } else if (choice2 == "3") { if (checkWeight(_weightFromWeapon, 25)) { Console.WriteLine("Equipped Steel armor."); CurrentArmor = _armor[2]; CurrentArmor.Print(); _hasArmor = true; menu3 = "0"; } else { Console.WriteLine("Weight limit reached"); } } else if (choice2 == "4") { if (checkWeight(_weightFromWeapon, 40)) { Console.WriteLine("Equipped Platnium armor."); CurrentArmor = _armor[3]; CurrentArmor.Print(); _hasArmor = true; menu3 = "0"; } else { Console.WriteLine("Weight limit reached"); } } } } else { Console.WriteLine("There is armor equipped"); } }