LogarithmicValue() приватный статический Метод

private static LogarithmicValue ( float distance, float minDistance, float rolloffScale ) : float
distance float
minDistance float
rolloffScale float
Результат float
Пример #1
0
        private static AnimationCurve Logarithmic(float timeStart, float timeEnd, float logBase)
        {
            List <Keyframe> list = new List <Keyframe>();
            float           num  = 2f;

            timeStart = Mathf.Max(timeStart, 0.0001f);
            float value;
            float num3;
            float num4;

            for (float num2 = timeStart; num2 < timeEnd; num2 *= num)
            {
                value = AudioSourceInspector.LogarithmicValue(num2, timeStart, logBase);
                num3  = num2 / 50f;
                num4  = (AudioSourceInspector.LogarithmicValue(num2 + num3, timeStart, logBase) - AudioSourceInspector.LogarithmicValue(num2 - num3, timeStart, logBase)) / (num3 * 2f);
                list.Add(new Keyframe(num2, value, num4, num4));
            }
            value = AudioSourceInspector.LogarithmicValue(timeEnd, timeStart, logBase);
            num3  = timeEnd / 50f;
            num4  = (AudioSourceInspector.LogarithmicValue(timeEnd + num3, timeStart, logBase) - AudioSourceInspector.LogarithmicValue(timeEnd - num3, timeStart, logBase)) / (num3 * 2f);
            list.Add(new Keyframe(timeEnd, value, num4, num4));
            return(new AnimationCurve(list.ToArray()));
        }
        private static AnimationCurve Logarithmic(float timeStart, float timeEnd, float logBase)
        {
            List <Keyframe> keyframeList = new List <Keyframe>();
            float           num1         = 2f;

            timeStart = Mathf.Max(timeStart, 0.0001f);
            float num2 = timeStart;

            while ((double)num2 < (double)timeEnd)
            {
                float num3 = AudioSourceInspector.LogarithmicValue(num2, timeStart, logBase);
                float num4 = num2 / 50f;
                float num5 = (float)(((double)AudioSourceInspector.LogarithmicValue(num2 + num4, timeStart, logBase) - (double)AudioSourceInspector.LogarithmicValue(num2 - num4, timeStart, logBase)) / ((double)num4 * 2.0));
                keyframeList.Add(new Keyframe(num2, num3, num5, num5));
                num2 *= num1;
            }
            float num6 = AudioSourceInspector.LogarithmicValue(timeEnd, timeStart, logBase);
            float num7 = timeEnd / 50f;
            float num8 = (float)(((double)AudioSourceInspector.LogarithmicValue(timeEnd + num7, timeStart, logBase) - (double)AudioSourceInspector.LogarithmicValue(timeEnd - num7, timeStart, logBase)) / ((double)num7 * 2.0));

            keyframeList.Add(new Keyframe(timeEnd, num6, num8, num8));
            return(new AnimationCurve(keyframeList.ToArray()));
        }