/// <summary> /// Handles the selection of the user if they have chosen to participate /// </summary> static void HumanSelection() { player1 = humanPlayerGenerator.GeneratePlayer("Player 1"); Console.WriteLine("Please select: " + newLine); Console.WriteLine("1 for Rock" + newLine); Console.WriteLine("2 for Paper: " + newLine); Console.WriteLine("3 for Scissors: " + newLine); int weaponSelection = 0; while (!Enum.IsDefined(typeof(Selection), weaponSelection)) { int.TryParse(Console.ReadLine() + newLine, out weaponSelection); if (!Enum.IsDefined(typeof(Selection), weaponSelection)) { Console.WriteLine("Invalid selection. Please select a weapon using numbers between 1 & 3." + newLine); } } Selection selectedWeapon = (Selection)weaponSelection; player1.SelectedValue = selectedWeapon; Console.WriteLine(player1.Name + " chose " + selectedWeapon + newLine); }
/// <summary> /// Handles the selection of the computer if the user has chosen not to participate /// </summary> static void ComputerSelection() { player1 = computerPlayerGenerator.GeneratePlayer("Player 1"); Console.WriteLine(player1.Name + " chose " + player1.SelectedValue + newLine); }