예제 #1
0
 public static void Generate(LevelBuilder builder, Palette palette)
 {
     UnityEngine.Profiling.Profiler.BeginSample("Maze.Generate");
     Clear();
     GenerateRooms(builder.info.maze.rooms[0]);
     GenerateSpecialRooms(palette);
     Build(builder, palette);
     UnityEngine.Profiling.Profiler.EndSample();
 }
예제 #2
0
 private static void Build(LevelBuilder builder, Palette palette)
 {
     for (int x = 0; x < grid.GetLength(0); ++x)
     {
         for (int y = 0; y < grid.GetLength(1); ++y)
         {
             PlaceRoom(builder, palette, x, y);
         }
     }
 }
예제 #3
0
        private static void PlaceRoom(LevelBuilder builder, Palette palette, int x, int y)
        {
            Room room = grid[x, y];

            if (!room.fill)
            {
                return;
            }

            if (room.special)
            {
                int index = SpecialIndex(room.dirMask);
                builder.Place(palette.special[room.specialIndex][index], new Vector2i(x, y));
            }
            else
            {
                int           index = GenerateDirMask(x, y);
                LevelPreset[] set   = Random.Range(0, 2) == 0 ? palette.rooms : palette.themedRooms;
                builder.Place(set[index], new Vector2i(x, y));
            }
        }