private static Vector3 CalculateCollisionPoint(Vector3 targetPosition, Vector3 cameraDirection, float rayLength, GameObject exlusionGameObject, out bool hasCollision)
        {
            RaycastHit hit;
            Vector3    vector    = new Vector3();
            int        layerMask = LayerMasksUtils.RemoveLayerFromMask(LayerMasks.STATIC, exlusionGameObject.layer);

            hasCollision = Physics.Raycast(targetPosition, -cameraDirection, out hit, rayLength, layerMask);
            return(!hasCollision ? (targetPosition - (cameraDirection * rayLength)) : (hit.point + (0.5f * hit.normal)));
        }
        public static Vector3 CalculateCameraPosition(Transform target, BaseRendererComponent tankRendererComponent, Vector3 tankBoundsCenter, BezierPosition bezierPosition, CameraData cameraData, Vector3 cameraOffset, float additionalAngle)
        {
            GameObject gameObject    = target.gameObject;
            Vector3    position      = target.position;
            Vector3    localPosition = target.parent.localPosition;
            float      z             = tankRendererComponent.Mesh.bounds.extents.z;
            float      num3          = z * Mathf.Max((float)0f, (float)((z - 1.2f) / 1.981962f));

            if (target.parent != null)
            {
                Vector3 vector4 = target.parent.InverseTransformPoint(tankBoundsCenter);
                num3 -= vector4.z - localPosition.z;
            }
            Vector3    vector5        = new Vector3(0f, 0f, -num3);
            Quaternion quaternion     = Quaternion.Euler(target.rotation.eulerAngles + new Vector3(0f, additionalAngle, 0f));
            Vector3    vector6        = (Vector3)(quaternion * (vector5 - new Vector3(0f, 0f, localPosition.z)));
            Vector3    targetPosition = (position + (quaternion * (localPosition + cameraOffset))) + (Vector3.up * 0.2f);
            bool       hasCollision   = false;
            bool       flag2          = false;
            Vector3    vector11       = CalculateCollisionPoint(targetPosition, CalculateCameraDirection(bezierPosition.GetCameraHeight() / bezierPosition.GetCameraHorizontalDistance(), (Vector3)(Quaternion.Euler(new Vector3(0f, additionalAngle, 0f)) * target.forward)), bezierPosition.GetDistanceToPivot(), gameObject, out hasCollision);
            float      magnitude      = (targetPosition - vector11).magnitude;

            cameraData.collisionDistanceRatio = magnitude / bezierPosition.GetDistanceToPivot();
            if (magnitude < 3f)
            {
                float rayLength = 3f - magnitude;
                vector11 = CalculateCollisionPoint(vector11, -Vector3.up, rayLength, gameObject, out flag2);
            }
            else
            {
                RaycastHit hit;
                int        layerMask  = LayerMasksUtils.RemoveLayerFromMask(LayerMasks.STATIC, gameObject.layer);
                Vector3    normalized = vector6.normalized;
                vector11 = !Physics.Raycast(vector11, normalized, out hit, vector6.magnitude, layerMask) ? (vector11 + vector6) : (vector11 + (Mathf.Max((float)(hit.distance - 0.5f), (float)0f) * normalized));
            }
            return(vector11);
        }