public static void ArtTitle() { Console.ForegroundColor = ConsoleColor.Yellow; Console.Title = "ASCII Art"; Console.WriteLine(); // breakline Console.WriteLine(); // breakline Console.WriteLine(); // breakline string title = @" ██████╗ ██╗ ██╗ ██████╗ █████╗ ███╗ ███╗███████╗ ██╗ ██╔════╝████████╗ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝ ███║ ██║ ╚██╔═██╔╝ ██║ ███╗███████║██╔████╔██║█████╗ ╚██║ ██║ ████████╗ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ██║ ╚██████╗╚██╔═██╔╝ ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ "; Console.WriteLine(title); Console.WriteLine(); // breakline Console.ForegroundColor = ConsoleColor.Blue; CenterText.centerText("Press enter to continue..."); Console.ResetColor(); Console.ReadKey(); Console.Clear(); }
// Three parts to story //print out game title and overview public void StartGame() { CenterText.centerText("A roleplaying game"); Console.ResetColor(); "".PrintToConsole(); // breakline CharacterName(); // calling CharacterName method Choice(); // calling Choice method }
public Item() // ctor contsructor { // Instantiate random Random randomNumber = new Random(); // Random class is from System; int number; //Next(Int32) returns a non-negative random number less than the maximum number = randomNumber.Next(items.Count); name = items[number]; description = descriptions[number]; Console.ForegroundColor = ConsoleColor.Cyan; CenterText.centerText($"\n random item found: {name} {description} \n"); Console.ResetColor(); }
readonly List <string> inventory = new List <string>(); // inventory list //ask player for a name, and save it private void CharacterName() { Console.ForegroundColor = ConsoleColor.Cyan; CenterText.centerText("Choose the name of your character"); characterName = Console.ReadLine().Trim().ToLower(); characterNameProper = new CultureInfo("en-US").TextInfo.ToTitleCase(characterName); Console.Clear(); Console.ForegroundColor = ConsoleColor.Yellow; CenterText.centerText($"Hello {characterNameProper}"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Cyan; "".PrintToConsole(); // breakline }
public void EndGame() { //end of game text if (inventory.Contains("sulfuric acid")) { Console.ForegroundColor = ConsoleColor.Red; CenterText.centerText($"The recently deceased {characterNameProper} has left behind these items:"); Console.ResetColor(); } else { Console.ForegroundColor = ConsoleColor.Yellow; "".PrintToConsole(); CenterText.centerText($" *** Congratulations {characterNameProper} you found some items on your journey: "); "".PrintToConsole(); // breakline } "".PrintToConsole(); // breakline foreach (string item in inventory) { "".PrintToConsole(); CenterText.centerText($" - {item}"); } if (inventory.Contains("50 dollar bill") && inventory.Contains("sulfuric acid")) { "".PrintToConsole(); // breakline Console.ForegroundColor = ConsoleColor.Blue; CenterText.centerText($" and left behind 50 dollars"); Console.ResetColor(); } else if (inventory.Contains("50 dollar bill")) { Console.ForegroundColor = ConsoleColor.Blue; CenterText.centerText("and you found 50 dollars!"); Console.ResetColor(); } }