//Generate the dungeon
    private void CreateDungeon()
    {
        DestroyAllChildren();//Clear existing dungeon if present

        DugeonGenerator generator = new DugeonGenerator(dungeonWidth, dungeonLength);

        var listOfRooms = generator.CalculateDungeon(maxIterations,
                                                     roomWidthMin,
                                                     roomLengthMin,
                                                     roomBottomCornerModifier,
                                                     roomTopCornerMidifier,
                                                     roomOffset,
                                                     corridorWidth);

        GameObject wallParent = new GameObject("WallParent");

        wallParent.transform.parent = transform;

        possibleDoorVerticalPosition   = new List <Vector3Int>();
        possibleDoorHorizontalPosition = new List <Vector3Int>();
        possibleWallHorizontalPosition = new List <Vector3Int>();
        possibleWallVerticalPosition   = new List <Vector3Int>();

        //Create Mesh for created rooms
        for (int i = 0; i < listOfRooms.Count; i++)
        {
            CreateMesh(listOfRooms[i].BottomLeftAreaCorner, listOfRooms[i].TopRightAreaCorner);
        }

        CreateWalls(wallParent);
    }
Exemple #2
0
    private void CreateDungeon()
    {
        DugeonGenerator generator   = new DugeonGenerator(dungeonWidth, dungeonLength);
        var             listOfRooms = generator.CalculateDungeon(maxIterations,
                                                                 roomWidthMin,
                                                                 roomLengthMin,
                                                                 roomBottomCornerModifier,
                                                                 roomTopCornerMidifier,
                                                                 roomOffset,
                                                                 corridorWidth);

        for (int i = 0; i < listOfRooms.Count; i++)
        {
            CreateMesh(listOfRooms[i].BottomLeftAreaCorner, listOfRooms[i].TopRightAreaCorner);
        }
    }