Ejemplo n.º 1
0
        public void GetUserInput()
        {
            bool repeat = false;

            do
            {
                System.Console.Write("What do you want to do: ");

                string[] input   = Console.ReadLine().ToLower().Split(' ');
                string   command = input[0];
                string   option  = "";

                if (input.Length > 1)
                {
                    option += input[1];
                    // if (input.Length > 2)
                    // {
                    //   for (int i = 2; i < input.Length; i++)
                    //   {
                    //     option += " " + input[i];
                    //   }
                    // }
                }

                switch (command)
                {
                case "take":
                    TakeItem(option);
                    break;

                case "put":
                case "use":
                    UseItem(option);
                    break;

                case "go":
                case "head":
                case "walk":
                    Go(option);
                    break;

                case "north":
                case "n":
                    Go("north");
                    break;

                case "south":
                case "s":
                    Go("south");
                    break;

                case "west":
                case "w":
                    Go("west");
                    break;

                case "east":
                case "e":
                    Go("east");
                    break;

                case "look":
                    Look();
                    break;

                case "drop":
                    Drop(option);
                    break;

                case "inventory":
                    Inventory();
                    break;

                case "reset":
                    Reset();
                    break;

                case "help":
                    Help();
                    break;

                case "talk":
                    if (CurrentRoom.Name == "Auditorium" && CurrentPlayer.HasFishInEar)
                    {
                        CurrentRoom.CallBack(CurrentPlayer, CurrentRoom);
                    }
                    else
                    {
                        Console.WriteLine("Blah blah blah");
                    }
                    break;

                case "quit":
                    Quit();
                    break;

                default:
                    System.Console.WriteLine("Unknown Command");
                    repeat = true;
                    break;
                }
            } while (repeat == true);
        }
Ejemplo n.º 2
0
 public void Go(string direction)
 {
     CurrentRoom = CurrentRoom.Go(direction);
     CurrentRoom.CallBack(CurrentPlayer, CurrentRoom);
 }