コード例 #1
0
        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();
        }
コード例 #2
0
        // 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
        }
コード例 #3
0
ファイル: Item.cs プロジェクト: kironroy/AdventureGame
        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();
        }
コード例 #4
0
        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
        }
コード例 #5
0
        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();
            }
        }