public int GetPlayerChoice() { List <String> allOptions = new List <string>(); allOptions.AddRange(_options.SelectMany((option => option.GetOptions())).ToArray()); allOptions.Add("Leave Town"); for (int i = 0; i < allOptions.Count; i++) { Console.WriteLine($"{i}) {allOptions[i]}"); } Console.Write("Enter the number of the action you want to take: "); return(GameUtils.GetNumberInput()); }
public int GetPlayerChoice() { Console.WriteLine(); GameUtils.GetDelayedText("What do you want to do now?"); string[] playerOptions = player.GetOptions(); List <string> allOptions = new List <string>(playerOptions); allOptions.Add("Search for more monsters to slay!"); allOptions.Add(("I want to head into town!")); for (int i = 0; i < allOptions.Count; i++) { Console.WriteLine($"{i}) {allOptions[i]}"); } Console.Write("Choice: "); return(GameUtils.GetNumberInput()); }
public Food AskWhichFoodToEat() { Console.WriteLine($"Current health: {health}/{baseHealth}"); Console.WriteLine("Which food do you want to consume?"); for (int i = 0; i < _foods.Count; i++) { Console.WriteLine($"{i}) {_foods[i]}"); } Console.Write("Enter your choice: "); int choice = GameUtils.GetNumberInput(); if (choice >= 0 && choice < _foods.Count) { return(_foods[choice]); } return(null); }