public void Go(string direction) { //CurrentRoom.Exits.ContainsKey("north") Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom(direction); //if in second room => go find winning item description if (CurrentRoom.Name == "Courtyard") { CurrentRoom.Exits["south"].Description = "\n\tYou have left Adventure's Keep with out retrieving the Artifact you've been searching for! \n\tGo back and continue your search!"; } WinGame(); Console.WriteLine("\n\t" + CurrentRoom.Description); }
public void Go(string direction) { //changes the user from one room to another if the exit to the other room exists // CurrentRoom = CurrentRoom.ChangeRoom(direction); // Console.WriteLine($@"{CurrentRoom.Name} // {CurrentRoom.Description}"); //returns "" if exit doesnt exist if (CurrentRoom != CurrentRoom.ChangeRoom(direction)) { CurrentRoom = CurrentRoom.ChangeRoom(direction); System.Console.WriteLine(""); Console.WriteLine($@"{CurrentRoom.Name}: {CurrentRoom.Description}"); } }
//----------Takes in the players command inputs----------\\ public void UserCommand() { string input = Console.ReadLine().ToUpper(); string input1 = input.Split(" ")[0]; string input2 = ""; if (input.Split(" ").Length > 1) { input2 = input.Split(" ")[1]; } switch (input1.ToUpper()) { case "HELP": case "H": Guide(); break; case "NORTH": case "N": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("north"); Look(); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("What do you do next?"); Console.ForegroundColor = ConsoleColor.White; break; case "SOUTH": case "S": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("south"); Look(); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("What do you do next?"); Console.ForegroundColor = ConsoleColor.White; break; case "EAST": case "E": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("east"); Look(); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("What do you do next?"); Console.ForegroundColor = ConsoleColor.White; break; case "WEST": case "W": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("west"); Look(); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("What do you do next?"); Console.ForegroundColor = ConsoleColor.White; break; case "TAKE": case "T": { TakeItem(input2); } break; case "USE": case "use": { UseItem(input2); } break; case "LOOK": { Look(); } break; case "R": Reset(); break; case "X": Console.Clear(); Console.WriteLine("Brave Adventurer ran away.\n"); Console.WriteLine("Bravely ran away away. \n"); Console.WriteLine("When Danger reared it's ugly head.\n"); Console.WriteLine("You bravely turnred your tail and fled.\n"); Console.WriteLine("Yes brave Adventurer turned about.\n"); Console.WriteLine("And gallantly you chickened out. \n"); Console.WriteLine("Please press ['R'] to restart the game."); break; } }
public void GetUserInput() { while (Playing) //command seperate from direction { Console.Write("What do you do now?"); string input = Console.ReadLine().ToLower(); string firstWord = input.Split(" ")[0]; //first word string secondWord = ""; if (input.Split(" ").Length > 1) //second word { secondWord = input.Split(" ")[1]; } switch (input) { case "help": Help(); break; case "look": Look(); break; case "take pig": TakeItem(secondWord); break; case "use pig": UseItem(secondWord); break; case "backpack": Backpack(); break; case "go north": // Go("north"); CurrentRoom = CurrentRoom.ChangeRoom("north"); Look(); break; case "go east": // Go("east"); CurrentRoom = CurrentRoom.ChangeRoom("east"); Look(); break; case "go west": // Go("west") CurrentRoom = CurrentRoom.ChangeRoom("west"); Look(); break; case "go south": // Go("south"); if (CurrentRoom.Name == "Main Barn Room") { EndGame(); } else { CurrentRoom = CurrentRoom.ChangeRoom("south"); Look(); } break; case "quit": Quit(); break; // default: // Console.WriteLine("You cannot do that."); // break; } } }
//Player Command Inputs public void UserCommand() { string input = Console.ReadLine().ToLower(); string input1 = input.Split(" ")[0]; string input2 = ""; if (input.Split(" ").Length > 1) { input2 = input.Split(" ")[1]; } switch (input1.ToLower()) { case "help": case "h": Guide(); break; case "left": case "l": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("left"); Look(); break; case "right": case "r": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("right"); Look(); break; case "forward": case "f": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("forward"); Look(); break; case "back": case "b": Console.Clear(); CurrentRoom = CurrentRoom.ChangeRoom("back"); Look(); break; case "take": case "t": TakeItem(input2); break; case "use": case "u": UseItem(input2); break; case "look": Look(); break; case "reset": Reset(); break; case "quit": case "q": Quit(); break; case "inventory": case "i": LookInventory(); break; } }
public void GetUserInput() { while (Playing) { string input = Console.ReadLine().ToLower(); string input1 = input.Split(" ")[0]; string input2 = ""; if (input.Split(" ").Length > 1) { input2 = input.Split(" ")[1]; } switch (input) { case "help": Help(); break; case "look": Look(); break; case "take": TakeItem(input2); break; case "use": System.Console.WriteLine("You win!");; break; case "bag": Bag(); break; case "north": CurrentRoom = CurrentRoom.ChangeRoom("north"); Look(); Console.Write("Which way?"); break; case "east": CurrentRoom = CurrentRoom.ChangeRoom("east"); Look(); Console.Write("Which way?"); break; case "west": if (CurrentRoom.Name == "Creepy Basement") { } CurrentRoom = CurrentRoom.ChangeRoom("west"); Look(); Console.Write("Which way?"); break; case "south": CurrentRoom = CurrentRoom.ChangeRoom("south"); // EndGame(); break; case "quit": Quit(); break; } } }