private void updateDesiredPercent()
    {
        int  num  = -1;
        bool flag = isZoomActive;

        isZoomActive = false;
        if (!isSuspended && isCameraInValidState())
        {
            if (useCustomZoom)
            {
                isZoomActive = true;
            }
            else
            {
                for (int i = 0; i < Switches.Length; i++)
                {
                    if (Switches[i].ActivationSwitch != null && Switches[i].ActivationSwitch.enabled && Switches[i].ActivationSwitch.OnOff)
                    {
                        isZoomActive = true;
                        num          = i;
                        break;
                    }
                }
            }
        }
        if (isZoomActive)
        {
            AnimatorStateInfo currentAnimatorStateInfo = anim.GetCurrentAnimatorStateInfo(AnimationHashes.Layers.Base);
            if (LocomotionUtils.IsLocomoting(currentAnimatorStateInfo) || LocomotionHelper.IsCurrentControllerOfType <SlideController>(localPlayer) || (LocomotionHelper.IsCurrentControllerOfType <SwimController>(localPlayer) && !LocomotionUtils.IsSwimmingIdle(currentAnimatorStateInfo)))
            {
                targetDesiredPercent = (useCustomZoom ? customZoom.ZoomPercentOnMove : Switches[num].ZoomPercentOnMove);
            }
            else
            {
                targetDesiredPercent = (useCustomZoom ? customZoom.ZoomPercentOnIdle : Switches[num].ZoomPercentOnIdle);
            }
            if (useCustomZoom)
            {
                zoomOutDelay = customZoom.ZoomOutDelay;
                targetDesiredHeightOffset = customZoom.HeightOffset;
            }
            else
            {
                zoomOutDelay = Switches[num].ZoomOutDelay;
                targetDesiredHeightOffset = Switches[num].HeightOffset;
            }
            zoomOutDelayActive = false;
        }
        else if (flag && zoomOutDelay > 0f)
        {
            zoomOutDelayActive  = true;
            elapsedZoomOutDelay = 0f;
        }
        else if (!zoomOutDelayActive)
        {
            targetDesiredPercent = 0f;
        }
        if (zoomOutDelayActive)
        {
            elapsedZoomOutDelay += Time.deltaTime;
            if (elapsedZoomOutDelay >= zoomOutDelay)
            {
                elapsedZoomOutDelay  = 0f;
                zoomOutDelayActive   = false;
                targetDesiredPercent = 0f;
            }
        }
        if (targetDesiredPercent != desiredPercent || targetDesiredHeightOffset != desiredHeightOffset)
        {
            elapsedTime         = 0f;
            startPercent        = curPercent;
            desiredPercent      = targetDesiredPercent;
            startHeightOffset   = curHeightOffset;
            desiredHeightOffset = targetDesiredHeightOffset;
        }
        elapsedTime += Time.deltaTime;
        if (elapsedTime > Duration)
        {
            elapsedTime = Duration;
        }
    }