예제 #1
0
        private void TravelAction()
        {
            _gamePlayer.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation();
            _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);

            _gameConsoleView.DisplayCurrentLocationInfo();
        }
예제 #2
0
        private void HandleObjectAddedToInventory(object gameObject, EventArgs e)
        {
            if (gameObject.GetType() == typeof(PlayerObject))
            {
                PlayerObject playerObject = gameObject as PlayerObject;
                switch (playerObject.Type)
                {
                case PlayerObjectType.Food:
                    break;

                case PlayerObjectType.Medicine:
                    break;

                case PlayerObjectType.Weapon:
                    break;

                case PlayerObjectType.Treasure:
                    break;

                case PlayerObjectType.Information:
                    break;

                case PlayerObjectType.Key:

                    SpaceTimeLocation test = _gameUniverse.GetSpaceTimeLocationById(3);
                    test.Accessible = true;
                    break;

                default:
                    break;
                }
            }
        }
예제 #3
0
파일: Universe.cs 프로젝트: lewins1/TBQuest
        public SpaceTimeLocation GetSpaceTimeLocationById(int Id)
        {
            SpaceTimeLocation spaceTimeLocation = null;

            //
            // run through the space-time location list and grab the correct one
            //
            foreach (SpaceTimeLocation location in _spaceTimeLocations)
            {
                if (location.SpaceTimeLocationID == Id)
                {
                    spaceTimeLocation = location;
                }
            }

            //
            // the specified ID was not found in the universe
            // throw and exception
            //
            if (spaceTimeLocation == null)
            {
                string feedbackMessage = $"The Space-Time Location ID {Id} does not exist in the current Universe.";
                throw new ArgumentException(Id.ToString(), feedbackMessage);
            }

            return(spaceTimeLocation);
        }
예제 #4
0
파일: Text.cs 프로젝트: lewins1/TBQuest
        public static string LookAround(SpaceTimeLocation spaceTimeLocation)
        {
            string messageBoxText =
                $"Current Location: {spaceTimeLocation.CommonName}\n" +
                spaceTimeLocation.GeneralContents;

            return(messageBoxText);
        }
예제 #5
0
파일: Text.cs 프로젝트: lewins1/TBQuest
        public static string CurrentLocationInfo(SpaceTimeLocation spaceTimeLocation)
        {
            string messageBoxText =
                $"Current Location: {spaceTimeLocation.CommonName}\n" +
                " \n" +
                spaceTimeLocation.Description;

            return(messageBoxText);
        }
예제 #6
0
파일: Universe.cs 프로젝트: lewins1/TBQuest
        public bool IsAccessibleLocation(int spaceTimeLocationId)
        {
            SpaceTimeLocation spaceTimeLocation = GetSpaceTimeLocationById(spaceTimeLocationId);

            if (spaceTimeLocation.Accessible == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #7
0
        public void DisplayLookAround()
        {
            SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);

            List <GameObject> gameObjectsInCurrentSpaceTimeLocation = _gameUniverse.GetGameObjectsBySpaceTimeLocationId(_gamePlayer.SpaceTimeLocationID);

            List <Npc> npcsInCurrentSpaceTimeLocation = _gameUniverse.GetNpcsBySpaceTimeLocationId(_gamePlayer.SpaceTimeLocationID);

            string messageBoxText = Text.LookAround(currentSpaceTimeLocation) + Environment.NewLine + Environment.NewLine;

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentSpaceTimeLocation) + Environment.NewLine;
            messageBoxText += Text.NpcsChooseList(npcsInCurrentSpaceTimeLocation);

            DisplayGamePlayScreen("Current Location", messageBoxText, ActionMenu.MainMenu, "");
        }
예제 #8
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction playerActionChoice = PlayerAction.None;

            //
            // display splash screen
            //
            _playingGame = _gameConsoleView.DisplaySpashScreen();

            //
            // player chooses to quit
            //
            if (!_playingGame)
            {
                Environment.Exit(1);
            }

            //
            // display introductory message
            //
            _gameConsoleView.DisplayGamePlayScreen("Mission Intro", Text.MissionIntro(), ActionMenu.MissionIntro, "");
            _gameConsoleView.GetContinueKey();

            //
            // initialize the mission player
            //
            InitializeMission();

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");

            //
            // game loop
            //
            while (_playingGame)
            {
                UpdateGameStatus();
                //
                // get next game action from player
                //
                playerActionChoice = GetNextPlayerAction();

                //
                // choose an action based on the player's menu choice
                //
                switch (playerActionChoice)
                {
                case PlayerAction.None:
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayPlayerInfo();
                    break;

                case PlayerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    break;

                case PlayerAction.Travel:
                    TravelAction();
                    //_gamePlayer.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation();
                    //_currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);
                    //_gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    break;

                case PlayerAction.PlayerLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

                case PlayerAction.LookAt:
                    LookAtAction();
                    break;

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

                case PlayerAction.PutDown:
                    PutDownAction();
                    break;

                case PlayerAction.Inventory:
                    _gameConsoleView.DisplayInventory();
                    break;

                case PlayerAction.TalkTo:
                    TalkToAction();
                    break;


                case PlayerAction.ListSpaceTimeLocations:
                    _gameConsoleView.DisplayListOfSpaceTimeLocations();
                    break;

                case PlayerAction.ListNonPlayerCharacters:
                    _gameConsoleView.DisplayListOfAllNpcObjects();
                    break;

                case PlayerAction.PlayerMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.PlayerMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Player Menu", "Select an operation from the menu.", ActionMenu.PlayerMenu, "");
                    break;

                case PlayerAction.ObjectMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, "");
                    break;

                case PlayerAction.NonplayerCharacterMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu;
                    _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, "");
                    break;

                case PlayerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    break;

                case PlayerAction.AdminMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, "");
                    break;

                case PlayerAction.ReturnToMainMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    break;

                case PlayerAction.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }
예제 #9
0
        public void DisplayCurrentLocationInfo()
        {
            SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);

            DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(currentSpaceTimeLocation), ActionMenu.MainMenu, "");
        }