コード例 #1
0
        /// <summary>
        /// initialize the major game objects
        /// </summary>
        private void InitializeGame()
        {
            _gameTraveler    = new Traveler();
            _gameUniverse    = new Universe();
            _gameConsoleView = new ConsoleView(_gameTraveler, _gameUniverse);
            _playingGame     = true;

            //
            // add initial items to the traveler's inventory
            //
            _gameTraveler.Inventory.Add(_gameUniverse.GetGameObjectById(8) as TravelerObject);
            _gameTraveler.Inventory.Add(_gameUniverse.GetGameObjectById(9) as TravelerObject);

            Console.CursorVisible = false;
        }
コード例 #2
0
ファイル: Text.cs プロジェクト: helixo12/TBQuestGame
        public static string InitializeMissionEchoTravelerInfo(Traveler gameTraveler)
        {
            string messageBoxText =
                $"Very good then {gameTraveler.Name}.\n" +
                " \n" +
                "It appears we have all the necessary info to begin your Quest. You will find it" +
                " listed below.\n" +
                " \n" +
                $"\tTraveler Name: {gameTraveler.Name}\n" +
                $"\tTraveler Age: {gameTraveler.Age}\n" +
                $"\tTraveler Race: {gameTraveler.Race}\n" +
                " \n" +
                "Press any key to begin your Quest.";

            return(messageBoxText);
        }
コード例 #3
0
ファイル: ConsoleView.cs プロジェクト: helixo12/TBQuestGame
        /// <summary>
        /// get the player's initial information at the beginning of the game
        /// </summary>
        /// <returns>traveler object with all properties updated</returns>
        public Traveler GetInitialTravelerInfo()
        {
            Traveler traveler = new Traveler();

            //
            // intro
            //
            DisplayGamePlayScreen("Quest Initialization", Text.InitializeMissionIntro(), ActionMenu.MissionIntro, "");
            GetContinueKey();

            //
            // get traveler's name
            //
            DisplayGamePlayScreen("Quest Initialization - Name", Text.InitializeMissionGetTravelerName(), ActionMenu.MissionIntro, "");
            DisplayInputBoxPrompt("Enter your name: ");
            traveler.Name = GetString();

            //
            // get traveler's age
            //
            DisplayGamePlayScreen("Quest Initialization - Age", Text.InitializeMissionGetTravelerAge(traveler.Name), ActionMenu.MissionIntro, "");
            int gameTravelerAge;

            GetInteger($"Enter your age {traveler.Name}: ", 0, 1000000, out gameTravelerAge);
            traveler.Age = gameTravelerAge;

            //
            // get traveler's race
            //
            DisplayGamePlayScreen("Quest Initialization - Race", Text.InitializeMissionGetTravelerRace(traveler), ActionMenu.MissionIntro, "");
            DisplayInputBoxPrompt($"Enter your race {traveler.Name}: ");
            traveler.Race = GetRace();

            //
            // echo the traveler's info
            //
            DisplayGamePlayScreen("Quest Initialization - Complete", Text.InitializeMissionEchoTravelerInfo(traveler), ActionMenu.MissionIntro, "");
            GetContinueKey();

            //
            // change view status to playing game
            //
            _viewStatus = ViewStatus.PlayingGame;

            return(traveler);
        }
コード例 #4
0
ファイル: Text.cs プロジェクト: helixo12/TBQuestGame
        public static string InitializeMissionGetTravelerRace(Traveler gameTraveler)
        {
            string messageBoxText =
                $"{gameTraveler.Name}, it will be important for us to know your race on this Quest.\n" +
                " \n" +
                "Enter your race below.\n" +
                " \n" +
                "Please use the race classifications below." +
                " \n";

            string raceList = null;

            foreach (Character.RaceType race in Enum.GetValues(typeof(Character.RaceType)))
            {
                if (race != Character.RaceType.None)
                {
                    raceList += $"\t{race}\n";
                }
            }

            messageBoxText += raceList;

            return(messageBoxText);
        }