示例#1
0
        /// Print out the opening message for the player.
        private void printWelcome()
        {
            Console.WriteLine(
                @"Welcome to Loyola!
This is a pretty boring game, unless you modify it.
Type 'help' if you need help.

{0}", currentPlace.getLongDescription());
        }
示例#2
0
        /// Try to go to one direction. If there is an exit, enter the new
        /// place, otherwise print an error message.
        /// Return false(does not end game)
        public bool Execute(Command command)
        {
            if (!command.hasSecondWord())
            {
                // if there is no second word, we don't know where to go...
                Console.WriteLine("Go where?");
                return(false);
            }
            string direction = command.GetSecondWord();
            // Try to leave current place.
            Place nextPlace = game.GetCurrentPlace().getExit(direction);

            if (nextPlace == null)
            {
                Console.WriteLine("There is no door!");
            }
            else
            {
                game.SetCurrentPlace(nextPlace);
                Console.WriteLine(nextPlace.getLongDescription());
            }
            return(false);
        }