public List <RoomNode> GenerateRoomsInGivenSpace(List <Node> roomSpaces,
                                                     float roomBottomCornerModifier,
                                                     float roomTopCornerModifier,
                                                     int roomOffset)
    {
        List <RoomNode> listToReturn = new List <RoomNode>();

        foreach (var space in roomSpaces)
        {
            Vector2Int newBottomLeftPoint = StructureHelper.GenerateBottomLeftCornerBetween(
                space.BottomLeftAreaCorner,
                space.TopRightAreaCorner,
                0.1f, 1); // change values for increase randomess, closeness of rooms

            Vector2Int newTopRightPoint = StructureHelper.GenerateBottomLeftCornerBetween(
                space.BottomLeftAreaCorner,
                space.TopRightAreaCorner,
                0.9f, 1); // change values for increase randomess, closeness of rooms

            space.BottomLeftAreaCorner  = newBottomLeftPoint;
            space.TopRightAreaCorner    = newTopRightPoint;
            space.BottomRightAreaCorner = new Vector2Int(newTopRightPoint.x, newBottomLeftPoint.y);
            space.TopLeftAreaCorner     = new Vector2Int(newBottomLeftPoint.x, newTopRightPoint.y);
            listToReturn.Add((RoomNode)space);
        }

        return(listToReturn);
    }
Пример #2
0
    public List <RoomNode> GenerateRoomInGivenSpace(List <Node> roomSpaces, float bottomLeftPointModifier, float topRightPointModifier, int offset)
    {
        List <RoomNode> listToReturn = new List <RoomNode>();

        foreach (Node space in roomSpaces)
        {
            Vector2Int newBottomLeftPoint = StructureHelper.GenerateBottomLeftCornerBetween(
                space.BottomLeftAreaCorner,
                space.TopRightAreaCorner,
                bottomLeftPointModifier,
                offset);

            Vector2Int newTopRightPoint = StructureHelper.GenerateTopRightCornerBetween(
                space.BottomLeftAreaCorner,
                space.TopRightAreaCorner,
                topRightPointModifier,
                offset);

            space.BottomLeftAreaCorner  = newBottomLeftPoint;
            space.TopRightAreaCorner    = newTopRightPoint;
            space.BottomRightAreaCorner = new Vector2Int(newTopRightPoint.x, newBottomLeftPoint.y);
            space.TopLeftAreaCorner     = new Vector2Int(newBottomLeftPoint.x, newTopRightPoint.y);

            listToReturn.Add((RoomNode)space);
        }

        return(listToReturn);
    }
Пример #3
0
    public List <RoomNode> GenerateRoomsInGivenSpaces(List <Node> roomSpaces, float roomBottomCornerModifer, float roomTopCornerModifer, int roomOffset)
    {
        List <RoomNode> listToReturn = new List <RoomNode>();

        foreach (var space in roomSpaces)
        {
            Vector2Int newBottomLeftPoint = StructureHelper.GenerateBottomLeftCornerBetween(space.BottomLeftAreaCorridor, space.TopRightAreaCorridor, roomBottomCornerModifer, roomOffset);
            Vector2Int newTopRightPoint   = StructureHelper.GenerateTopRightCornerBetween(space.BottomLeftAreaCorridor, space.TopRightAreaCorridor, roomTopCornerModifer, roomOffset);

            space.BottomLeftAreaCorridor  = newBottomLeftPoint;
            space.TopRightAreaCorridor    = newTopRightPoint;
            space.BottomRightAreaCorridor = new Vector2Int(newTopRightPoint.x, newBottomLeftPoint.y);
            space.TopLeftAreaCorridor     = new Vector2Int(newBottomLeftPoint.x, newTopRightPoint.y);

            listToReturn.Add((RoomNode)space);
        }

        return(listToReturn);
    }