//private void DiveAction() //{ // get dive objects and choose a random one //} //private void WorkbenchAction() //{ // // make CraftedItems based on inventory items // // chisel // // knife // // fishing spear // // axe // // canoe // // assembled radio //} //private void PierAction() //{ // // rebuild pier based on inventory items //} //private void ShipAction() //{ // // get ship objects and choose a random one //} //private void FirepitAction() //{ // // build fire based on inventory items //} //private void TreasureChestAction() //{ // // give radio transmitter //} #endregion /// <summary> /// display the correct menu/sub-menu and get the next traveler action /// </summary> /// <returns>traveler action</returns> private SurvivorAction GetNextTravelerAction() { SurvivorAction survivorActionChoice = SurvivorAction.None; switch (ActionMenu.currentMenu) { case ActionMenu.CurrentMenu.MainMenu: survivorActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu); break; case ActionMenu.CurrentMenu.ObjectMenu: survivorActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ObjectMenu); break; case ActionMenu.CurrentMenu.NpcMenu: survivorActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.NpcMenu); break; case ActionMenu.CurrentMenu.TravelerMenu: survivorActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.SurvivorMenu); break; case ActionMenu.CurrentMenu.AdminMenu: survivorActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.AdminMenu); break; default: break; } return(survivorActionChoice); }
/// <summary> /// get a action menu choice from the user /// </summary> /// <returns>action menu choice</returns> public SurvivorAction GetActionMenuChoice(Menu menu) { SurvivorAction choosenAction = SurvivorAction.None; Console.CursorVisible = false; // // create an array of valid keys from menu dictionary // char[] validKeys = menu.MenuChoices.Keys.ToArray(); // // validate key pressed as in MenuChoices dictionary // char keyPressed; do { ConsoleKeyInfo keyPressedInfo = Console.ReadKey(true); keyPressed = keyPressedInfo.KeyChar; } while (!validKeys.Contains(keyPressed)); choosenAction = menu.MenuChoices[keyPressed]; Console.CursorVisible = true; return(choosenAction); }
public void SetUp() { navMeshAgent = GetComponent <NavMeshAgent>(); navMeshAgent.updatePosition = true; inventory = GetComponent <SurvivorInventory>(); inventory.survivor = this; action = GetComponent <SurvivorAction>(); animator = GetComponent <Animator>(); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { SurvivorAction survivorActionChoice = SurvivorAction.None; // // display splash screen // _playingGame = _gameConsoleView.DisplaySpashScreen(); // // player chooses to quit // if (!_playingGame) { Environment.Exit(1); } // // display introductory message // _gameConsoleView.DisplayGamePlayScreen("Quest Intro", Text.QuestIntro(), ActionMenu.QuestIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission traveler // InitializeMission(); // // prepare game play screen // _currentLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID); _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID)), ActionMenu.MainMenu, ""); // // game loop // while (_playingGame) { // // process all flags, events, and stats // UpdateGameStatus(_playingGame); // // get next game action from player // survivorActionChoice = GetNextTravelerAction(); // // choose an action based on the user's menu choice // switch (survivorActionChoice) { case SurvivorAction.None: break; case SurvivorAction.SurvivorInfo: _gameConsoleView.DisplaySurvivorInfo(); break; case SurvivorAction.SurvivorEditInfo: _gameConsoleView.EditSurvivorInfo(_gameSurvivor); break; case SurvivorAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case SurvivorAction.LookAt: LookAtAction(); break; case SurvivorAction.PickUp: PickUpAction(); break; case SurvivorAction.PutDown: PutDownAction(); break; case SurvivorAction.InteractWith: InteractWithAction(); break; case SurvivorAction.Inventory: _gameConsoleView.DisplayInventory(); break; case SurvivorAction.Travel: // // get new location choice and update the current location property // _gameSurvivor.IslandLocationID = _gameConsoleView.DisplayGetNextIslandLocation(); _currentLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID); // // set the game play screen to the current location info format // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); UpdateGameStatus(_playingGame); break; case SurvivorAction.SurvivorLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); break; case SurvivorAction.ListIslandLocations: _gameConsoleView.DisplayListOfIslandLocations(); break; case SurvivorAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); break; case SurvivorAction.ListNonplayerCharacters: _gameConsoleView.DisplayListOfAllNpcObjects(); break; case SurvivorAction.SurvivorMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.TravelerMenu; _gameConsoleView.DisplayGamePlayScreen("Traveler Menu", "Select an operation from the menu.", ActionMenu.SurvivorMenu, ""); break; case SurvivorAction.ObjectMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu; _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, ""); break; case SurvivorAction.NonplayerCharacterMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu; _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, ""); break; case SurvivorAction.TalkTo: TalkToAction(); break; case SurvivorAction.AskToScavenge: AskToScavenge(); break; case SurvivorAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, ""); break; case SurvivorAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case SurvivorAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { SurvivorAction survivorActionChoice = SurvivorAction.None; // // display splash screen // _playingGame = _gameConsoleView.DisplaySpashScreen(); // // player chooses to quit // if (!_playingGame) { Environment.Exit(1); } // // display introductory message // _gameConsoleView.DisplayGamePlayScreen("Intro", Text.MissionIntro(), ActionMenu.MissionIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission traveler // InitializeMission(); // // prepare game play screen // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrrentLocationInfo(), ActionMenu.MainMenu, ""); _currentLocation = _worldContents.GetLocationById(_gameSurvivor.LocationId); // // game loop // while (_playingGame) { UpdateGameStatus(); // _gameConsoleView.DisplayStatusBox(); //get next action choice survivorActionChoice = GetNextSurvivorAction(); // choose an action based on the user's menu choice switch (survivorActionChoice) { case SurvivorAction.None: break; case SurvivorAction.SurvivorInfo: _gameConsoleView.DisplaySurvivorInfo(); break; case SurvivorAction.ListLocations: _gameConsoleView.DisplayListOfLocations(); break; case SurvivorAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case SurvivorAction.Travel: //get new location choice and update current location _gameSurvivor.LocationId = _gameConsoleView.GetNextLocation(); _currentLocation = _worldContents.GetLocationById(_gameSurvivor.LocationId); //set gameplayscreen as current location info _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case SurvivorAction.SurvivorLocationsVisited: _gameConsoleView.DisplayLocationsVisisted(); //_gameConsoleView.DisplayStatusBox(); break; case SurvivorAction.ListGameObjects: _gameConsoleView.DisplayListOfGameObjects(); // _gameConsoleView.DisplayStatusBox(); break; case SurvivorAction.DisplayNonPlayableCharacters: _gameConsoleView.DisplayListOfNpcObjects(); break; case SurvivorAction.LookAt: LookAtAction(); break; case SurvivorAction.PickUp: PickUpAction(); break; case SurvivorAction.PutDown: PutDownAction(); break; case SurvivorAction.TalkTo: TalkToAction(); break; case SurvivorAction.Inventory: _gameConsoleView.DisplayInventory(); break; case SurvivorAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an option from the menu", ActionMenu.AdminMenu, ""); break; case SurvivorAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case SurvivorAction.ObjectMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu; _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an action from the menu.", ActionMenu.ObjectMenu, ""); break; case SurvivorAction.SurvivorMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.SurvivorMenu; _gameConsoleView.DisplayGamePlayScreen("Survivor Menu", "Select an option from the menu.", ActionMenu.SurvivorMenu, ""); break; case SurvivorAction.NonplayerCharacterMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu; _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an option from the menu.", ActionMenu.NpcMenu, ""); break; case SurvivorAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }