public PresetDungeon(Room room)
            : base()
        {
            rooms.Add(room);

            ender = new SquareChunk(room.getSize(), 1000);

            starter.setColor(room.getColor());
            ender.setColor(room.getColor());
        }
示例#2
0
        /// <summary>
        /// Generates the Dungeon by creating a random number of rooms.
        /// </summary>
        private void generateDungeon()
        {
            Room room;
            int size = random.Next(4, 10);
            int height = 230;
            int pos = 0;
            for (int i = 0; i < size; i++)
            {
                room = new Room(height, pos, this);
                height = room.getChunk(room.getSize() - 1).getHeight(); //gets height of the last room.
                pos += room.getSize(); //increases the chunk position
                rooms.Add(room);
                if (i == 0) starter.setColor(room.getColor());
            }
            ender = new SquareChunk(rooms.ElementAt(rooms.Count - 1).getSize(), 10000);
            ender.setColor(rooms.ElementAt(rooms.Count - 1).getColor());

            DungeonManager.getInstance().setCurrentDungeon(this);
        }