示例#1
0
        // Token: 0x06003101 RID: 12545 RVA: 0x0012DA08 File Offset: 0x0012BC08
        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(float.MaxValue, float.MaxValue, float.MaxValue);
                Vector3 a      = new Vector3(float.MinValue, float.MinValue, float.MinValue);
                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;
            }
        }