Beispiel #1
0
    // Array dirs = Enum.GetValues(typeof(Dir));

    public TileBase[,] MakeDungeonFloor(DungeonParams dungeonParams)
    {
        this.roomSize       = dungeonParams.roomSize;
        this.corridorLength = dungeonParams.corridorLength;
        this.maxSize        = dungeonParams.maxSize;
        this.roomCount      = dungeonParams.roomCount;
        this.corridorWidth  = dungeonParams.corridorWidth;


        TileBase[,] roomTiles = new TileBase[0, 0];
        while (dungeonParams.tries != 0)
        {
            tempCorridor = Rect.zero;
            rooms        = new List <Rect>();
            corridors    = new List <Rect>();
            roomTiles    = GenBigRoom(new TileBase[maxSize.x, maxSize.y], new Vector2Int(roomSize.y, roomSize.y), Dir.RIGHT);
            if (rooms.Count < roomCount.x)
            {
                dungeonParams.tries--;
                continue;
            }
            ;
            return(roomTiles);
        }
        Debug.Log("Failed to produce enough rooms! Current count: " + rooms.Count);
        return(roomTiles);
    }
Beispiel #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);
    }
Beispiel #3
0
 [DllImport("DungeonGenerator", CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr Lib_Dungeon_paramsConstructor(DungeonParams _params);
Beispiel #4
0
 public Dungeon(DungeonParams p)
 {
     m_handle = Lib_Dungeon_paramsConstructor(p);
 }
Beispiel #5
0
 [DllImport("DungeonGenerator", CallingConvention = CallingConvention.Cdecl)] private static extern void Lib_Dungeon_setParams(IntPtr _this, DungeonParams _params);