static void Main(string[] args) { ParseCommand parseCMD = new ParseCommand(); ExecuteCmd executeCmd = new ExecuteCmd(); World.CreateRooms(); bool isValid = false; while (true) { Console.Clear(); Player.ChangeLocation(); //TODO: set this up to read next part of story currentRoom.DescribeRoom(); //Console.SetCursorPosition(5, 20); Console.WriteLine("\n Enter a command...: "); //Console.SetCursorPosition(5, 23); string input = Console.ReadLine(); if (input.ToLower() == "exit") { Console.WriteLine("\n Thanks for playing"); Console.ReadKey(); break; } isValid = parseCMD.Validate(input); if (isValid) { executeCmd.ProcessCmd(input); } else { Console.WriteLine("\n Sorry, Command " + input.ToUpper() + " is not recognized. Try again"); Console.ReadKey(); } } }
//The Main Game Stuff public void Run() { //Create the Rooms Room playerRoom = Game.CreateRooms(); //New Player Name Console.WriteLine("Hello " + Player.name + ". Do you have a Name?"); if (yesno().Equals(true)) { Console.WriteLine("\nSo, what should I call you?"); Player.name = Console.ReadLine(); } Console.WriteLine("\nOk " + Player.name + ". Let`s beginn... "); //Movement and Options bool quit = false; do { //Discribe playerRoom Room.DescribeRoom(playerRoom); //Direction Label Direction: //Direction Input string direction; Console.WriteLine("> "); direction = Console.ReadLine().ToUpper(); //Direction switch (direction) { case "N": if (playerRoom.North != null) { playerRoom = playerRoom.North; } break; case "E": if (playerRoom.East != null) { playerRoom = playerRoom.East; } break; case "S": if (playerRoom.South != null) { playerRoom = playerRoom.South; } break; case "W": if (playerRoom.West != null) { playerRoom = playerRoom.West; } break; case "Q": if (yesno().Equals(true)) { Console.WriteLine("\nBye."); quit = true; } break; default: Console.WriteLine(Player.name + " , I`m wating..."); goto Direction; } } while (quit == false); }