예제 #1
0
    private float SmoothStepInterpolation(float percentage, CameraPathFOVList.ProjectionType projectionType)
    {
        int           lastPointIndex = base.GetLastPointIndex(percentage);
        CameraPathFOV cameraPathFOV  = (CameraPathFOV)base.GetPoint(lastPointIndex);
        CameraPathFOV cameraPathFOV2 = (CameraPathFOV)base.GetPoint(lastPointIndex + 1);
        float         percent        = cameraPathFOV.percent;
        float         num            = cameraPathFOV2.percent;

        if (percent > num)
        {
            num += 1f;
        }
        float num2 = num - percent;
        float num3 = percentage - percent;
        float val  = num3 / num2;
        float num4 = (projectionType != CameraPathFOVList.ProjectionType.FOV) ? cameraPathFOV.Size : cameraPathFOV.FOV;
        float num5 = (projectionType != CameraPathFOVList.ProjectionType.FOV) ? cameraPathFOV2.Size : cameraPathFOV2.FOV;

        return(Mathf.Lerp(num4, num5, CPMath.SmoothStep(val)));
    }
예제 #2
0
 public float GetValue(float percentage, CameraPathFOVList.ProjectionType type)
 {
     if (base.realNumberOfPoints < 2)
     {
         if (type == CameraPathFOVList.ProjectionType.FOV)
         {
             if (base.realNumberOfPoints == 1)
             {
                 return(this[0].FOV);
             }
             return(this.defaultFOV);
         }
         else
         {
             if (base.realNumberOfPoints == 1)
             {
                 return(this[0].Size);
             }
             return(this.defaultSize);
         }
     }
     else
     {
         percentage = Mathf.Clamp(percentage, 0f, 1f);
         CameraPathFOVList.Interpolation interpolation = this.interpolation;
         if (interpolation == CameraPathFOVList.Interpolation.Linear)
         {
             return(this.LinearInterpolation(percentage, type));
         }
         if (interpolation != CameraPathFOVList.Interpolation.SmoothStep)
         {
             return(this.LinearInterpolation(percentage, type));
         }
         return(this.SmoothStepInterpolation(percentage, type));
     }
 }