Beispiel #1
0
        // Token: 0x06002BA1 RID: 11169 RVA: 0x00104660 File Offset: 0x00102860
        public static void CacheBounds(Transform transform, GameObject target, List <OrientedBounds> results, bool append = false)
        {
            if (!append)
            {
                results.Clear();
            }

            if (target == null)
            {
                return;
            }

            ConstructableBounds[] componentsInChildren = target.GetComponentsInChildren <ConstructableBounds>();
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                ConstructableBounds constructableBounds = componentsInChildren[i];
                OrientedBounds      localBounds         = constructableBounds.bounds;
                OrientedBounds      orientedBounds      = OrientedBounds.ToWorldBounds(constructableBounds.transform, localBounds);
                if (transform != null)
                {
                    orientedBounds = OrientedBounds.ToLocalBounds(transform, orientedBounds);
                }

                results.Add(orientedBounds);
            }
        }
Beispiel #2
0
        public void Initialize(UIElement element)
        {
            localRotation     = default;
            localScale        = default;
            localPosition     = default;
            scale             = default;
            screenPosition    = default;
            pivot             = default;
            actualSize        = default;
            allocatedSize     = default;
            rotation          = default;
            border            = default;
            padding           = default;
            margin            = default;
            localMatrix       = default;
            pivotOffset       = default;
            allocatedPosition = default;
            alignedPosition   = default;
            layoutParent      = default;
            orientedBounds    = default;
            axisAlignedBounds = default;
            clipper           = default;
            isCulled          = default;
            rebuildGeometry   = default;

            this.element = element;
            this.matrix  = SVGXMatrix.identity;
        }
Beispiel #3
0
    public void SetEntireSize(float width, float height)
    {
        int            widthDirection  = (int)this.m_WidthDirection;
        int            heightDirection = (int)this.m_HeightDirection;
        OrientedBounds sliceBounds     = this.GetSliceBounds(this.m_topLeft);
        OrientedBounds bounds2         = this.GetSliceBounds(this.m_top);
        OrientedBounds bounds3         = this.GetSliceBounds(this.m_topRight);
        OrientedBounds bounds4         = this.GetSliceBounds(this.m_left);
        OrientedBounds bounds5         = this.GetSliceBounds(this.m_right);
        OrientedBounds bounds6         = this.GetSliceBounds(this.m_bottomLeft);
        OrientedBounds bounds7         = this.GetSliceBounds(this.m_bottom);
        OrientedBounds bounds8         = this.GetSliceBounds(this.m_bottomRight);

        float[] values = new float[] { sliceBounds.Extents[widthDirection].magnitude, bounds4.Extents[widthDirection].magnitude, bounds6.Extents[widthDirection].magnitude };
        float   num3   = Mathf.Max(values) * 2f;

        float[] singleArray2 = new float[] { bounds3.Extents[widthDirection].magnitude, bounds5.Extents[widthDirection].magnitude, bounds8.Extents[widthDirection].magnitude };
        float   num4         = Mathf.Max(singleArray2) * 2f;

        float[] singleArray3 = new float[] { sliceBounds.Extents[heightDirection].magnitude, bounds2.Extents[heightDirection].magnitude, bounds3.Extents[heightDirection].magnitude };
        float   num5         = Mathf.Max(singleArray3) * 2f;

        float[] singleArray4 = new float[] { bounds6.Extents[heightDirection].magnitude, bounds7.Extents[heightDirection].magnitude, bounds8.Extents[heightDirection].magnitude };
        float   num6         = Mathf.Max(singleArray4) * 2f;

        this.SetSize((width - num3) - num4, (height - num5) - num6);
    }
Beispiel #4
0
        // Token: 0x06002BA3 RID: 11171 RVA: 0x00104750 File Offset: 0x00102950
        public static bool CheckSpace(Vector3 position, Quaternion rotation, List <OrientedBounds> localBounds, int layerMask, Collider allowedCollider)
        {
            if (rotation.IsDistinguishedIdentity())
            {
                rotation = Quaternion.identity;
            }

            for (int i = 0; i < localBounds.Count; i++)
            {
                OrientedBounds orientedBounds = localBounds[i];
                if (orientedBounds.rotation.IsDistinguishedIdentity())
                {
                    orientedBounds.rotation = Quaternion.identity;
                }

                orientedBounds.position = position + rotation * orientedBounds.position;
                orientedBounds.rotation = rotation * orientedBounds.rotation;
                if (!MultiplayerBuilder.CheckSpace(orientedBounds.position, orientedBounds.rotation, orientedBounds.extents, layerMask, allowedCollider))
                {
                    return(false);
                }
            }

            return(true);
        }
    protected void LayoutMenuBackground()
    {
        OrientedBounds bounds = TransformUtil.ComputeOrientedWorldBounds(this.m_menu.m_buttonContainer.gameObject, true);
        float          width  = bounds.Extents[0].magnitude * 2f;
        float          height = bounds.Extents[2].magnitude * 2f;

        this.m_menu.m_background.SetSize(width, height);
        this.m_menu.m_border.SetSize(width, height);
    }
    public OrientedBounds GetOrientedBounds()
    {
        Matrix4x4      localToWorldMatrix = base.transform.localToWorldMatrix;
        OrientedBounds bounds             = new OrientedBounds {
            Origin = base.transform.position + (localToWorldMatrix * this.m_offset)
        };

        bounds.Extents = new Vector3[] { localToWorldMatrix *new Vector3(this.m_size.x * 0.5f, 0f, 0f), localToWorldMatrix *new Vector3(0f, this.m_size.y * 0.5f, 0f), localToWorldMatrix *new Vector3(0f, 0f, this.m_size.z * 0.5f) };
        return(bounds);
    }
Beispiel #7
0
        // Token: 0x06002BA7 RID: 11175 RVA: 0x001048CC File Offset: 0x00102ACC
        public static void GetObstacles(Vector3 position, Quaternion rotation, List <OrientedBounds> localBounds, List <GameObject> results)
        {
            results.Clear();
            if (rotation.IsDistinguishedIdentity())
            {
                rotation = Quaternion.identity;
            }

            List <GameObject> list = new List <GameObject>();

            for (int i = 0; i < localBounds.Count; i++)
            {
                OrientedBounds orientedBounds = localBounds[i];
                if (orientedBounds.rotation.IsDistinguishedIdentity())
                {
                    orientedBounds.rotation = Quaternion.identity;
                }

                orientedBounds.position = position + rotation * orientedBounds.position;
                orientedBounds.rotation = rotation * orientedBounds.rotation;
                MultiplayerBuilder.GetOverlappedColliders(orientedBounds.position, orientedBounds.rotation, orientedBounds.extents, MultiplayerBuilder.sCollidersList);
                MultiplayerBuilder.GetRootObjects(MultiplayerBuilder.sCollidersList, list);
                for (int j = list.Count - 1; j >= 0; j--)
                {
                    GameObject go = list[j];
                    if (!MultiplayerBuilder.IsObstacle(go))
                    {
                        list.RemoveAt(j);
                    }
                }

                for (int k = 0; k < MultiplayerBuilder.sCollidersList.Count; k++)
                {
                    Collider collider = MultiplayerBuilder.sCollidersList[k];
                    if (MultiplayerBuilder.IsObstacle(collider))
                    {
                        GameObject gameObject = collider.gameObject;
                        if (!list.Contains(gameObject))
                        {
                            list.Add(gameObject);
                        }
                    }
                }

                MultiplayerBuilder.sCollidersList.Clear();
                for (int l = 0; l < list.Count; l++)
                {
                    GameObject item = list[l];
                    if (!results.Contains(item))
                    {
                        results.Add(item);
                    }
                }
            }
        }
Beispiel #8
0
        // Token: 0x06002BA0 RID: 11168 RVA: 0x001045D8 File Offset: 0x001027D8
        public static void OnDrawGizmos()
        {
            Matrix4x4 matrix = Gizmos.matrix;
            Color     color  = Gizmos.color;

            Gizmos.matrix = OrientedBounds.TransformMatrix(MultiplayerBuilder.placePosition, MultiplayerBuilder.placeRotation);
            Gizmos.color  = new Color(0f, 0f, 1f, 0.5f);
            Gizmos.DrawCube(MultiplayerBuilder.aaBounds.center, MultiplayerBuilder.aaBounds.extents * 2f);
            Gizmos.matrix = matrix;
            Gizmos.color  = color;
            MultiplayerBuilder.OnDrawGizmos();
        }
 public void UpdateSlices()
 {
     if (this.m_slices.Count != 0)
     {
         float   num        = !this.m_reverse ? 1f : -1f;
         int     direction  = (int)this.m_direction;
         Slice[] sliceArray = this.m_slices.FindAll(s => TransformUtil.CanComputeOrientedWorldBounds(s.m_slice, this.m_useUberText, this.m_ignore, true)).ToArray();
         if (sliceArray.Length != 0)
         {
             Vector3    zero = Vector3.zero;
             Matrix4x4  worldToLocalMatrix = base.transform.worldToLocalMatrix;
             Vector3    min   = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
             Vector3    max   = new Vector3(float.MinValue, float.MinValue, float.MinValue);
             Slice      slice = sliceArray[0];
             GameObject go    = slice.m_slice;
             go.transform.localPosition = Vector3.zero;
             OrientedBounds bounds    = TransformUtil.ComputeOrientedWorldBounds(go, this.m_useUberText, slice.m_minLocalPadding, slice.m_maxLocalPadding, this.m_ignore, true);
             float          num3      = num * (!slice.m_reverse ? 1f : -1f);
             Vector3        vector4   = (Vector3)(((bounds.Extents[0] + bounds.Extents[1]) + bounds.Extents[2]) * num3);
             Transform      transform = go.transform;
             transform.position += bounds.CenterOffset + vector4;
             zero = ((Vector3)(bounds.Extents[direction] * num3)) + vector4;
             TransformUtil.GetBoundsMinMax((Vector3)(worldToLocalMatrix * (go.transform.position - bounds.CenterOffset)), (Vector3)(worldToLocalMatrix * bounds.Extents[0]), (Vector3)(worldToLocalMatrix * bounds.Extents[1]), (Vector3)(worldToLocalMatrix * bounds.Extents[2]), ref min, ref max);
             Vector3 vector5 = (Vector3)(this.m_localSliceSpacing * num);
             for (int i = 1; i < sliceArray.Length; i++)
             {
                 Slice      slice2 = sliceArray[i];
                 GameObject obj3   = slice2.m_slice;
                 float      num5   = num * (!slice2.m_reverse ? 1f : -1f);
                 obj3.transform.localPosition = Vector3.zero;
                 OrientedBounds bounds2    = TransformUtil.ComputeOrientedWorldBounds(obj3, this.m_useUberText, slice2.m_minLocalPadding, slice2.m_maxLocalPadding, this.m_ignore, true);
                 Vector3        vector6    = (Vector3)(obj3.transform.localToWorldMatrix * vector5);
                 Vector3        vector7    = (Vector3)(bounds2.Extents[direction] * num5);
                 Transform      transform2 = obj3.transform;
                 transform2.position += ((bounds2.CenterOffset + zero) + vector7) + vector6;
                 zero += ((Vector3)(vector7 * 2f)) + vector6;
                 TransformUtil.GetBoundsMinMax((Vector3)(worldToLocalMatrix * (obj3.transform.position - bounds2.CenterOffset)), (Vector3)(worldToLocalMatrix * bounds2.Extents[0]), (Vector3)(worldToLocalMatrix * bounds2.Extents[1]), (Vector3)(worldToLocalMatrix * bounds2.Extents[2]), ref min, ref max);
             }
             Vector3 vector8  = new Vector3(min.x, max.y, min.z);
             Vector3 vector9  = new Vector3(max.x, min.y, max.z);
             Vector3 vector10 = (Vector3)(base.transform.localToWorldMatrix * (vector8 + this.GetAlignmentVector(vector9 - vector8)));
             Vector3 vector11 = (Vector3)((base.transform.localToWorldMatrix * this.m_localPinnedPointOffset) * num);
             Vector3 vector12 = base.transform.position - vector10;
             Vector3 vector13 = vector11 + vector12;
             foreach (Slice slice3 in sliceArray)
             {
                 Transform transform3 = slice3.m_slice.transform;
                 transform3.position += vector13;
             }
         }
     }
 }
Beispiel #10
0
    private OrientedBounds GetSliceBounds(GameObject slice)
    {
        if (slice != null)
        {
            return(TransformUtil.ComputeOrientedWorldBounds(slice, base.m_ignore, true));
        }
        OrientedBounds bounds = new OrientedBounds();

        bounds.Extents      = new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero };
        bounds.Origin       = Vector3.zero;
        bounds.CenterOffset = Vector3.zero;
        return(bounds);
    }
Beispiel #11
0
        public void LayoutGameMenuBackground()
        {
            if (!IsButtonContainerAvailable())
            {
                return;
            }
            var            buttonListMenuDef   = GetButtonListMenuDef();
            OrientedBounds orientedWorldBounds = TransformUtil.ComputeOrientedWorldBounds(buttonListMenuDef.m_buttonContainer.gameObject, true);
            float          width  = orientedWorldBounds.Extents[0].magnitude * 2f;
            float          height = orientedWorldBounds.Extents[2].magnitude * 2f;

            buttonListMenuDef.m_background.SetSize(width, height);
            buttonListMenuDef.m_border.SetSize(width, height);
        }
Beispiel #12
0
    public static unsafe void SetLocalScaleToWorldDimension(GameObject obj, List <GameObject> ignoreMeshes, params WorldDimensionIndex[] dimensions)
    {
        Vector3        localScale = obj.transform.localScale;
        OrientedBounds bounds     = ComputeOrientedWorldBounds(obj, ignoreMeshes, true);

        for (int i = 0; i < dimensions.Length; i++)
        {
            ref Vector3 vectorRef;
            int         num3;
            float       num2 = bounds.Extents[dimensions[i].Index].magnitude * 2f;
            float       num4 = vectorRef[num3];
            (vectorRef = (Vector3) & localScale)[num3 = dimensions[i].Index] = num4 * ((num2 > Mathf.Epsilon) ? (dimensions[i].Dimension / num2) : 0.001f);
            if (Mathf.Abs(localScale[dimensions[i].Index]) < 0.001f)
            {
                localScale[dimensions[i].Index] = 0.001f;
            }
        }
Beispiel #13
0
    public void SetEntireHeight(float height)
    {
        int            heightDirection = (int)this.m_HeightDirection;
        OrientedBounds sliceBounds     = this.GetSliceBounds(this.m_topLeft);
        OrientedBounds bounds2         = this.GetSliceBounds(this.m_top);
        OrientedBounds bounds3         = this.GetSliceBounds(this.m_topRight);
        OrientedBounds bounds4         = this.GetSliceBounds(this.m_bottomLeft);
        OrientedBounds bounds5         = this.GetSliceBounds(this.m_bottom);
        OrientedBounds bounds6         = this.GetSliceBounds(this.m_bottomRight);

        float[] values = new float[] { sliceBounds.Extents[heightDirection].magnitude, bounds2.Extents[heightDirection].magnitude, bounds3.Extents[heightDirection].magnitude };
        float   num2   = Mathf.Max(values) * 2f;

        float[] singleArray2 = new float[] { bounds4.Extents[heightDirection].magnitude, bounds5.Extents[heightDirection].magnitude, bounds6.Extents[heightDirection].magnitude };
        float   num3         = Mathf.Max(singleArray2) * 2f;

        this.SetHeight((height - num2) - num3);
    }
Beispiel #14
0
    public void SetEntireWidth(float width)
    {
        int            widthDirection = (int)this.m_WidthDirection;
        OrientedBounds sliceBounds    = this.GetSliceBounds(this.m_topLeft);
        OrientedBounds bounds2        = this.GetSliceBounds(this.m_left);
        OrientedBounds bounds3        = this.GetSliceBounds(this.m_bottomLeft);
        OrientedBounds bounds4        = this.GetSliceBounds(this.m_topRight);
        OrientedBounds bounds5        = this.GetSliceBounds(this.m_right);
        OrientedBounds bounds6        = this.GetSliceBounds(this.m_bottomRight);

        float[] values = new float[] { sliceBounds.Extents[widthDirection].magnitude, bounds2.Extents[widthDirection].magnitude, bounds3.Extents[widthDirection].magnitude };
        float   num2   = Mathf.Max(values) * 2f;

        float[] singleArray2 = new float[] { bounds4.Extents[widthDirection].magnitude, bounds5.Extents[widthDirection].magnitude, bounds6.Extents[widthDirection].magnitude };
        float   num3         = Mathf.Max(singleArray2) * 2f;

        this.SetWidth((width - num2) - num3);
    }
        static bool Prefix(LargeWorldStreamer __instance, Bounds bb, Quaternion rot, bool isAdd = false, byte type = 1)
        {
            Bounds aaBB = bb;

            Vector3 min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            Vector3 max = new Vector3(float.MinValue, float.MinValue, float.MinValue);

            OrientedBounds.MinMaxBounds(OrientedBounds.TransformMatrix(bb.center, rot), Vector3.zero, bb.extents, ref min, ref max);

            aaBB.SetMinMax(min, max);

            Quaternion invRot = Quaternion.Inverse(rot);
            Vector3    c      = bb.center;

            __instance.PerformVoxelEdit(aaBB, (Vector3 wsPos) => VoxelandMisc.SignedDistToBox(bb, c + invRot * (wsPos - c)), isAdd, type);

            return(false);
        }
    private void UpdateLayout()
    {
        bool   activeSelf = this.m_alertIcon.activeSelf;
        Bounds textBounds = this.m_alertText.GetTextBounds();
        float  x          = textBounds.size.x;
        float  a          = (textBounds.size.y + this.m_padding) + this.m_popupInfo.m_padding;
        float  num3       = 0f;
        float  b          = 0f;

        if (activeSelf)
        {
            OrientedBounds bounds2 = TransformUtil.ComputeOrientedWorldBounds(this.m_alertIcon, true);
            num3 = bounds2.Extents[0].magnitude * 2f;
            b    = bounds2.Extents[2].magnitude * 2f;
        }
        x = Mathf.Max(TransformUtil.GetBoundsOfChildren(this.m_confirmButton).size.x * 2f, x);
        this.m_body.SetSize(x + num3, Mathf.Max(a, b));
        Vector3 offset = new Vector3(0f, 0.01f, 0f);

        TransformUtil.SetPoint(this.m_alertIcon, Anchor.TOP_LEFT_XZ, this.m_body.m_middle, Anchor.TOP_LEFT_XZ, offset);
        Transform transform = this.m_alertIcon.transform;

        transform.localPosition += this.m_alertIconOffset;
        if (this.m_popupInfo.m_alertTextAlignment == UberText.AlignmentOptions.Center)
        {
            TransformUtil.SetPoint(this.m_alertText, Anchor.TOP_XZ, this.m_body.m_middle, Anchor.TOP_XZ, offset);
        }
        else
        {
            TransformUtil.SetPoint(this.m_alertText, Anchor.TOP_LEFT_XZ, this.m_body.m_middle, Anchor.TOP_LEFT_XZ, offset);
        }
        Vector3 position = this.m_alertText.transform.position;

        position.x += num3;
        this.m_alertText.transform.position = position;
        if (this.m_popupInfo.m_alertTextAlignment == UberText.AlignmentOptions.Center)
        {
            this.m_alertText.Width -= num3;
        }
        this.UpdateButtons(this.m_popupInfo.m_responseDisplay);
        this.m_buttonContainer.transform.position = this.m_body.m_bottom.transform.position;
    }
Beispiel #17
0
    private void UpdateSegmentsToMatchMiddle()
    {
        OrientedBounds bounds = TransformUtil.ComputeOrientedWorldBounds(this.m_middle, base.m_ignore, true);

        if (bounds != null)
        {
            float dimension                  = bounds.Extents[(int)this.m_WidthDirection].magnitude * 2f;
            float num2                       = bounds.Extents[(int)this.m_HeightDirection].magnitude * 2f;
            int   widthDirection             = (int)this.m_WidthDirection;
            int   heightDirection            = (int)this.m_HeightDirection;
            WorldDimensionIndex[] dimensions = new WorldDimensionIndex[] { new WorldDimensionIndex(dimension, widthDirection) };
            this.SetSliceSize(this.m_top, dimensions);
            WorldDimensionIndex[] indexArray2 = new WorldDimensionIndex[] { new WorldDimensionIndex(dimension, widthDirection) };
            this.SetSliceSize(this.m_bottom, indexArray2);
            WorldDimensionIndex[] indexArray3 = new WorldDimensionIndex[] { new WorldDimensionIndex(num2, heightDirection) };
            this.SetSliceSize(this.m_left, indexArray3);
            WorldDimensionIndex[] indexArray4 = new WorldDimensionIndex[] { new WorldDimensionIndex(num2, heightDirection) };
            this.SetSliceSize(this.m_right, indexArray4);
        }
    }
Beispiel #18
0
        // Token: 0x06002B9F RID: 11167 RVA: 0x001044D0 File Offset: 0x001026D0
        private static void InitBounds(GameObject gameObject)
        {
            Transform transform = gameObject.transform;

            MultiplayerBuilder.CacheBounds(transform, gameObject, MultiplayerBuilder.bounds, false);
            MultiplayerBuilder._aaBounds.center  = Vector3.zero;
            MultiplayerBuilder._aaBounds.extents = Vector3.zero;
            int count = MultiplayerBuilder.bounds.Count;

            if (count > 0)
            {
                Vector3 vector = new Vector3(3.40282347E+38f, 3.40282347E+38f, 3.40282347E+38f);
                Vector3 a      = new Vector3(-3.40282347E+38f, -3.40282347E+38f, -3.40282347E+38f);
                for (int i = 0; i < count; i++)
                {
                    OrientedBounds orientedBounds      = MultiplayerBuilder.bounds[i];
                    Matrix4x4      boundsToLocalMatrix = OrientedBounds.TransformMatrix(orientedBounds.position, orientedBounds.rotation);
                    OrientedBounds.MinMaxBounds(boundsToLocalMatrix, Vector3.zero, orientedBounds.extents, ref vector, ref a);
                }
                MultiplayerBuilder._aaBounds.extents = (a - vector) * 0.5f;
                MultiplayerBuilder._aaBounds.center  = vector + MultiplayerBuilder.aaBounds.extents;
            }
        }
Beispiel #19
0
    public Vector2 GetWorldDimensions()
    {
        OrientedBounds bounds = TransformUtil.ComputeOrientedWorldBounds(this.m_middle, base.m_ignore, true);

        return(new Vector2(bounds.Extents[(int)this.m_WidthDirection].magnitude * 2f, bounds.Extents[(int)this.m_HeightDirection].magnitude * 2f));
    }
Beispiel #20
0
    public static OrientedBounds ComputeOrientedWorldBounds(GameObject go, bool includeUberText, Vector3 minLocalPadding, Vector3 maxLocalPadding, List <GameObject> ignoreMeshes, bool includeAllChildren = true)
    {
        if ((go == null) || !go.activeSelf)
        {
            return(null);
        }
        List <MeshFilter> list  = GetComponentsWithIgnore <MeshFilter>(go, ignoreMeshes, includeAllChildren);
        List <UberText>   list2 = null;

        if (includeUberText)
        {
            list2 = GetComponentsWithIgnore <UberText>(go, ignoreMeshes, includeAllChildren);
        }
        if (((list == null) || (list.Count == 0)) && ((list2 == null) || (list2.Count == 0)))
        {
            return(null);
        }
        Matrix4x4 worldToLocalMatrix = go.transform.worldToLocalMatrix;
        Vector3   min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
        Vector3   max = new Vector3(float.MinValue, float.MinValue, float.MinValue);

        if (list != null)
        {
            foreach (MeshFilter filter in list)
            {
                if (filter.gameObject.activeSelf)
                {
                    Matrix4x4 matrixx2    = filter.transform.localToWorldMatrix;
                    Bounds    bounds      = filter.sharedMesh.bounds;
                    Matrix4x4 matrixx3    = worldToLocalMatrix * matrixx2;
                    Vector3[] vectorArray = new Vector3[] { matrixx3 *new Vector3(bounds.extents.x, 0f, 0f), matrixx3 *new Vector3(0f, bounds.extents.y, 0f), matrixx3 *new Vector3(0f, 0f, bounds.extents.z) };
                    Vector3   vector3     = (Vector3)(matrixx2 * filter.sharedMesh.bounds.center);
                    Vector3   origin      = (Vector3)(worldToLocalMatrix * (filter.transform.position + vector3));
                    GetBoundsMinMax(origin, vectorArray[0], vectorArray[1], vectorArray[2], ref min, ref max);
                }
            }
        }
        if (list2 != null)
        {
            foreach (UberText text in list2)
            {
                if (text.gameObject.activeSelf)
                {
                    Matrix4x4 matrixx4     = text.transform.localToWorldMatrix;
                    Matrix4x4 matrixx5     = worldToLocalMatrix * matrixx4;
                    Vector3[] vectorArray2 = new Vector3[] { matrixx5 *new Vector3(text.Width * 0.5f, 0f, 0f), matrixx5 *new Vector3(0f, text.Height * 0.5f), matrixx5 *new Vector3(0f, 0f, 0.01f) };
                    GetBoundsMinMax((Vector3)(worldToLocalMatrix * text.transform.position), vectorArray2[0], vectorArray2[1], vectorArray2[2], ref min, ref max);
                }
            }
        }
        if (minLocalPadding.sqrMagnitude > 0f)
        {
            min -= minLocalPadding;
        }
        if (maxLocalPadding.sqrMagnitude > 0f)
        {
            max += maxLocalPadding;
        }
        Matrix4x4 localToWorldMatrix = go.transform.localToWorldMatrix;
        Matrix4x4 matrixx7           = localToWorldMatrix;

        matrixx7.SetColumn(3, Vector4.zero);
        Vector3        vector5 = (Vector3)(((localToWorldMatrix * max) + (localToWorldMatrix * min)) * 0.5f);
        Vector3        vector6 = (Vector3)((max - min) * 0.5f);
        OrientedBounds bounds3 = new OrientedBounds();

        bounds3.Extents      = new Vector3[] { matrixx7 *new Vector3(vector6.x, 0f, 0f), matrixx7 *new Vector3(0f, vector6.y, 0f), matrixx7 *new Vector3(0f, 0f, vector6.z) };
        bounds3.Origin       = vector5;
        bounds3.CenterOffset = go.transform.position - vector5;
        return(bounds3);
    }
        static void Prefix(ConstructableBase __instance, bool value)
        {
            if (Config.Instance.habitantModulesPartialBurying)
            {
                if (__instance._constructed != value && value)
                {
                    var constructableBoundsList = new List <ConstructableBounds>();
                    __instance.GetComponentsInChildren(true, constructableBoundsList);

                    var hasAnyOverlappedTerrainObstacles = false;

                    var orientedBoundsList = constructableBoundsList.Select(constructableBounds => OrientedBounds.ToWorldBounds(constructableBounds.transform, constructableBounds.bounds));
                    foreach (var orientedBounds in orientedBoundsList)
                    {
                        Logger.Debug($"Checking oriented bounds: {orientedBounds}");

                        var overlappedObjects = new List <GameObject>();
                        Builder.GetOverlappedObjects(orientedBounds.position, orientedBounds.rotation, orientedBounds.extents, overlappedObjects);

                        if (overlappedObjects.Any((gameObject) => Builder.IsObstacle(gameObject.GetComponent <Collider>())))
                        {
                            hasAnyOverlappedTerrainObstacles = true;
                            break;
                        }
                    }

                    if (hasAnyOverlappedTerrainObstacles)
                    {
                        foreach (var orientedBounds in orientedBoundsList)
                        {
                            var sizeExpand = Config.Instance.spaceBetweenTerrainHabitantModule;
                            LargeWorldStreamer.main.PerformBoxEdit(new Bounds(orientedBounds.position, orientedBounds.size + new Vector3(sizeExpand, sizeExpand, sizeExpand)), orientedBounds.rotation, false, 2);
                            Logger.Debug($"PerformBoxEdit() called using oriented bounds: {orientedBounds}");
                        }

                        var streamerV2 = LargeWorldStreamer.main.streamerV2;
                        streamerV2.clipmapStreamer.FlushRangesEdited(streamerV2.octreesStreamer.minLod, streamerV2.octreesStreamer.maxLod);
                    }
                }
            }
        }