Example #1
0
        public List <RoomInfo> GeneratePossibleNeighbours(LabyrinthGenerator generator)
        {
            var result = new List <RoomInfo>();

            if (levelNumber > 0)
            {
                result.AddRange(GeneratePossibleNeighboursOnLevel(generator, levelNumber - 1));
            }

            if (levelNumber < generator.numberOfLevels - 1)
            {
                result.AddRange(GeneratePossibleNeighboursOnLevel(generator, levelNumber + 1));
            }

            return(result);
        }
Example #2
0
        private List <RoomInfo> GeneratePossibleNeighboursOnLevel(LabyrinthGenerator generator, int newLevel)
        {
            var result = new List <RoomInfo>();

            if (roomNumber == generator.numberOfRoomsPerLevel - 1)
            {
                // Rooms with this room number form the central core of the tower.

                for (int i = 0; i < generator.numberOfRoomsPerLevel - 1; ++i)
                {
                    result.Add(new RoomInfo(newLevel, i));
                }
            }
            else
            {
                result.Add(new RoomInfo(newLevel, (roomNumber + 1) % (generator.numberOfRoomsPerLevel - 1)));
                result.Add(new RoomInfo(newLevel, (roomNumber + generator.numberOfRoomsPerLevel - 2) % (generator.numberOfRoomsPerLevel - 1)));
                result.Add(new RoomInfo(newLevel, generator.numberOfRoomsPerLevel - 1));
            }

            return(result);
        }