Пример #1
0
        //Attempt to Move in the direction specificed by the user
        public void Go(string direction)
        {
            //invalid direction entered
            if (!Directions.Contains(direction))
            {
                System.Console.WriteLine("\n I did not understand that direction.  Please try again brave knight");
                return;
            }
            //cannot attempt entry to Warroom while messenger is in the squire tower
            Console.Clear();
            if (CurrentRoom.Name == "Squire Tower" && MessengerInRoom && direction == "NORTH")
            {
                System.Console.WriteLine("\n As you approach the messenger, he startles awake and sees you.\n  He yells out 'WHO ARE YOU AND WHAT ARE YOU DOING HERE?'  You quickly exit back through the\n hallway to the west.  If only you had a way to distract the messenger...");
                Thread.Sleep(8000);
                Go("WEST");
                return;
            }

            //exiting the warroom to the tower after using the vial is bad!
            if (CurrentRoom.Name == "War Room" && VialUsed && direction == "SOUTH")
            {
                System.Console.WriteLine("\n As you exit through the door into the tower, the messenger\n dashes up the stairs with the Captain and his guard.  'THERE HE IS' yells the messenger.  As\n three burly guards approach you with their swords drawn, you realize that your mission has\n failed...");
                CurrentPlayer.Dead = true;
                Thread.Sleep(5000);
                EndGame();
            }
            //Try to exit the room
            Console.Clear();
            CurrentRoom = CurrentRoom.LeaveRoom(direction);

            //special conditions for certain rooms
            if (CurrentRoom.Name == "Castle Courtyard")
            {
                EnterCourtYard();
            }
            else if (CurrentRoom.Name == "Captain's Quarters")
            {
                EnterCaptQtrs();
            }
            else if (CurrentRoom.Name == "Dungeon")
            {
                EnterDungeon();
            }
            else if (CurrentRoom.Name == "Squire Tower")
            {
                EnterSquireTower();
            }
            else if (CurrentRoom.Name == "Throne Room")
            {
                EnterThroneRoom();
            }

            //all other rooms
            else
            {
                CurrentRoom.Visited = true;
                Look();
            }
        }
Пример #2
0
 public void Go(string direction)
 {
     CurrentRoom = (Room)CurrentRoom.LeaveRoom(direction);
 }