public ConsoleView(Player myPlayer, Pass pass, NPCList NPCs) { _myPlayer = myPlayer; _pass = pass; _NPCList = NPCs; InitializeConsoleWindow(); }
public ConsoleView(Player myPlayer, Pass pass, NPCList NPCs) { _myPlayer = myPlayer; _pass = pass; _NPCList = NPCs; }
public ConsoleView(Player myplayer) { }
private void ImplementPlayerAction(Player.PlayerChoice playerChoice) { _consoleView.DisplayMessage(""); switch (playerChoice) { case Player.PlayerChoice.None: case Player.PlayerChoice.Exit: _consoleView.DisplayExitPrompt(); break; case Player.PlayerChoice.Move: // player moves to hall //if (!_myPlayer.inPass) //{ // _myPlayer.inPass = true; // _consoleView.DisplayPassMessage(); //} //// player chooses room //else //{ int newCaveNumber = _consoleView.GetPlayerRoomNumberChoice(); _myPlayer.CaveNumber = newCaveNumber; _myPlayer.inPass = false; //} break; case Player.PlayerChoice.Search: bool treasureFound = false, npcFound = false; if (_myPlayer.CaveNumber == _chest.CaveNumber) { _consoleView.DisplayMessage("Treasure found!"); treasureFound = true; } foreach (NPC npc in _NPCList.NPCs) { if (npc.CaveNumber == _myPlayer.CaveNumber) { _consoleView.DisplayMessage(npc.Name + " the " + npc.Gender + " " + npc.Race + " has been found!"); npcFound = true; } } if (treasureFound == false && npcFound == false) { _consoleView.DisplayMessage("There is nothing here..."); } break; case Player.PlayerChoice.Open: List<TreasureItem> loot = new List<TreasureItem>(); if (_chest.CaveNumber == _myPlayer.CaveNumber) { TreasureItem key = _myPlayer.Inventory.FirstOrDefault(item => item.Name == "Beholder's Key"); loot = _chest.OpenContainer(key); if (loot == null) { _consoleView.DisplayMessage("You need a key to open this chest!"); _consoleView.DisplayContinuePrompt(); } else { foreach (TreasureItem item in loot) { _consoleView.DisplayMessage("Found " + item.Name); } _consoleView.DisplayMessage("Congratulations on beating the game!"); _consoleView.DisplayExitPrompt(); } } else { _consoleView.DisplayMessage("There is nothing here to open..."); } break; case Player.PlayerChoice.Talk: int i = 0; foreach (NPC npc in _NPCList.NPCs) { if (npc.CaveNumber == _myPlayer.CaveNumber) { _consoleView.DisplayMessage(npc.TalkTo(npc)); i = 1; if (npc.Inventory.Contains(_chest.Keys[0])) { _myPlayer.Inventory.Add(_chest.Keys[0]); npc.Inventory.Remove(_chest.Keys[0]); } } } if (i == 0) { _consoleView.DisplayMessage("There is no one here..."); } break; default: throw new System.ArgumentException("This ActionChoice has not been implemented in the switch.", ""); } _consoleView.DisplayContinuePrompt(); }
private void InitializePlayer() { _myPlayer = new Player() { Name = "Sindre", Gender = Models.Character.GenderType.Female, Race = Models.Character.RaceType.Elf }; _myPlayer.inPass = true; }