コード例 #1
0
        static void Main(string[] args)
        {
            //INITIAL LOAD
            GameData.DataBuild();

            //UI LOAD
            DialogBoxTopLine.Append(SpecialChars.DoubleLineLeftTop);
            for (int i = 0; i < 79; i++)
            {
                DialogBoxTopLine.Append(SpecialChars.DoubleLineAcross);
            }
            DialogBoxTopLine.Append(SpecialChars.DoubleLineRightTop);
            DialogBoxBottomLine.Append(SpecialChars.DoubleLineLeftBottom);
            for (int i = 0; i < 79; i++)
            {
                DialogBoxBottomLine.Append(SpecialChars.DoubleLineAcross);
            }
            DialogBoxBottomLine.Append(SpecialChars.DoubleLineRightBottom);

            DialogBoxCurrLine = 0;
            DialogBoxIndex    = 0;

            currentMap = GameData.AllMaps[2];
            p1         = new Player("Nemo", 'P', ConsoleColor.Cyan, 10);
            p1.SetHealthTo(6);
            PlayerInventory = new Inventory();
            PlayerArmory    = new Inventory();
            p1.EquipStartingWeapon(new Weapon("Fists", "Just your bare hands", 1, "Fist"));
            //Stopwatch for debug purposes
            sw = new Stopwatch();

            currentMap.TerrainData[currentMap.SpawnPoints[0].YVal, currentMap.SpawnPoints[0].XVal].SpawnCharacter(p1);
            Console.CursorVisible  = false;
            Console.OutputEncoding = Encoding.UTF8;
            Console.WindowWidth    = ConsoleWidth;
            Console.WindowHeight   = ConsoleHeight;
            Console.SetBufferSize(ConsoleWidth, ConsoleHeight);
            ConsoleLockdown.Lockdown();

            //ASTAR PATHFINDING TEST - BROKEN
            //currentMap.AICharacters[0].Path = Pathfinding.AStar(currentMap.TerrainData[currentMap.AICharacters[0].Position.YVal,currentMap.AICharacters[0].Position.XVal], currentMap.TerrainData[10, 10], currentMap);


            //INTRO
            PrintCenterLine("Welcome to the game.");
            PrintCenterLine("For best results, please right-click on the title bar and set your font to Courier New.");
            PrintCenterLine("Thank you for playing my game.");
            PrintCenterLine("Press any key to begin");
            Console.ReadKey();
            Console.Clear();

            //PLAYER SET UP
            PrintCenterLine("~~CHARACTER CREATION~~");
            PrintCenterLine("Firstly, what name would you like your character to have?");
            Console.CursorVisible = true;
            p1.Name = Console.ReadLine();
            Console.CursorVisible = false;
            Console.Clear();
            PrintCenterLine($"You shall henceforth and forever be known as {p1.Name}");
            PrintCenterLine("Press the enter key to start the game.");
            Console.ReadLine();

            //STORY BEGIN
            ScreenTransition.Transition();
            PrintCenterLine("You aren't entirely sure what has happened, but you find yourself in a ruined prison.");
            PrintCenterLine("Apparently, some goblins ambushed you while you were sleeping and imprisioned you.");
            PrintCenterLine("You probably didn't plan on your adventure starting like this, but here you are.");
            PrintCenterLine("This is actually quite fortuitous, because these goblins are mere pests.");
            PrintCenterLine("They shall serve as a whetstone upon which to sharpen your skills. A tutorial, as it were.");
            Console.ReadLine();
            Console.Clear();
            DrawEverything();

            //TURN CYCLE
            while (p1.Health > 0)
            {
                PlayerInput();

                CharacterAI();

                DrawEverything();
            }
        }