コード例 #1
0
    public void generateDungeon(float difficulty)
    {
        Debug.Log(difficulty);
        int floors = DifficultyToFloors(difficulty);

        dungeonFloors.Clear();
        activeFloor = 0;
        float floorDifficulty = (difficulty / floors) * 2;

        Debug.Log(floorDifficulty);

        for (int i = 0; i < floors; i++)
        {
            TileBase[,] floorWallTiles = digger.MakeDungeonFloor(
                DungeonPresets.difficultyToDungeonParams(floorDifficulty));
            List <Rect> floorRoomRects     = digger.rooms.ToList();
            List <Rect> floorCorridorRects = digger.corridors.ToList();
            List <Room> rooms = RoomBuilder.BuildRooms(
                floorDifficulty,
                floorWallTiles,
                floorRoomRects,
                floorCorridorRects);

            DungeonFloor dungeonFloor = new DungeonFloor(
                floorWallTiles,
                floorRoomRects,
                floorCorridorRects,
                rooms);
            dungeonFloors.Add(dungeonFloor);
        }
    }
コード例 #2
0
    // DungeonParams params;
    public void GenAndRender()
    {
        digger = new RoomDigger();
        DungeonParams dungeonParams = new DungeonParams(roomSize, corridorLength, maxSize, roomCount, tries, corridorWidth);

        TileBase[,] hey = digger.MakeDungeonFloor(dungeonParams);
        RenderTiles(hey);
    }