Ejemplo n.º 1
0
        public Room(int depth, int minRooms = 1, int maxRooms = 3)
        {
            Description = Descriptions[SAUSoCBot.Random.Next(0, Descriptions.Count)];
            if (depth <= 1)
            {
                return;
            }

            int rooms = SAUSoCBot.Random.Next(minRooms, maxRooms + 1);

            for (int i = 0; i < rooms; i++)
            {
                Room rm = new Room(depth - 1, minRooms, maxRooms);

                Passage passage = new Passage();
                passage.Previous = this;
                passage.Next     = rm;
                rm.PreviousRoom  = passage;

                Rooms.Add(passage);
            }
        }
Ejemplo n.º 2
0
        public string GetDescription()
        {
            if (IsExit)
            {
                return("You found the exit.");
            }
            string result = "You enter a " + Description.Modifer + " " + Description.Description + ".\n";

            if (!IsEntrance)
            {
                result += "Go back (0).\n";
            }

            if (Rooms.Count > 0)
            {
                result += "There is ";
            }
            else
            {
                result += "Its a dead end";
            }

            for (int i = 0; i < Rooms.Count; i++)
            {
                Passage p    = Rooms[i];
                string  desc = Utilities.FormatString(p.Description.Description, false, (i < Rooms.Count - 1 || Rooms.Count == 1)? "a " : "and a ", "");
                result += desc + " (" + (i + (IsEntrance ? 0 : 1)) + ")";

                if (i != Rooms.Count - 1)
                {
                    result += ", ";
                }
            }
            result += ".";
            return(result);
        }