Logarithmic() private static method

private static Logarithmic ( float timeStart, float timeEnd, float logBase ) : AnimationCurve
timeStart float
timeEnd float
logBase float
return UnityEngine.AnimationCurve
Exemplo n.º 1
0
        private CurveWrapper[] GetCurveWrapperArray()
        {
            List <CurveWrapper> list = new List <CurveWrapper>();

            AudioSourceInspector.AudioCurveWrapper[] audioCurves = this.m_AudioCurves;
            for (int i = 0; i < audioCurves.Length; i++)
            {
                AudioSourceInspector.AudioCurveWrapper audioCurveWrapper = audioCurves[i];
                if (audioCurveWrapper.curveProp != null)
                {
                    AnimationCurve animationCurve = audioCurveWrapper.curveProp.animationCurveValue;
                    bool           flag;
                    if (audioCurveWrapper.type == AudioSourceInspector.AudioCurveType.Volume)
                    {
                        AudioRolloffMode enumValueIndex = (AudioRolloffMode)this.m_RolloffMode.enumValueIndex;
                        if (this.m_RolloffMode.hasMultipleDifferentValues)
                        {
                            flag = false;
                        }
                        else if (enumValueIndex == AudioRolloffMode.Custom)
                        {
                            flag = !audioCurveWrapper.curveProp.hasMultipleDifferentValues;
                        }
                        else
                        {
                            flag = (!this.m_MinDistance.hasMultipleDifferentValues && !this.m_MaxDistance.hasMultipleDifferentValues);
                            if (enumValueIndex == AudioRolloffMode.Linear)
                            {
                                animationCurve = AnimationCurve.Linear(this.m_MinDistance.floatValue / this.m_MaxDistance.floatValue, 1f, 1f, 0f);
                            }
                            else if (enumValueIndex == AudioRolloffMode.Logarithmic)
                            {
                                animationCurve = AudioSourceInspector.Logarithmic(this.m_MinDistance.floatValue / this.m_MaxDistance.floatValue, 1f, 1f);
                            }
                        }
                    }
                    else
                    {
                        flag = !audioCurveWrapper.curveProp.hasMultipleDifferentValues;
                    }
                    if (flag)
                    {
                        if (animationCurve.length == 0)
                        {
                            Debug.LogError(audioCurveWrapper.legend.text + " curve has no keys!");
                        }
                        else
                        {
                            list.Add(this.GetCurveWrapper(animationCurve, audioCurveWrapper));
                        }
                    }
                }
            }
            return(list.ToArray());
        }
        private CurveWrapper[] GetCurveWrapperArray()
        {
            List <CurveWrapper> curveWrapperList = new List <CurveWrapper>();

            foreach (AudioSourceInspector.AudioCurveWrapper audioCurve in this.m_AudioCurves)
            {
                if (audioCurve.curveProp != null)
                {
                    AnimationCurve curve = audioCurve.curveProp.animationCurveValue;
                    bool           flag;
                    if (audioCurve.type == AudioSourceInspector.AudioCurveType.Volume)
                    {
                        AudioRolloffMode enumValueIndex = (AudioRolloffMode)this.m_RolloffMode.enumValueIndex;
                        if (this.m_RolloffMode.hasMultipleDifferentValues)
                        {
                            flag = false;
                        }
                        else if (enumValueIndex == AudioRolloffMode.Custom)
                        {
                            flag = !audioCurve.curveProp.hasMultipleDifferentValues;
                        }
                        else
                        {
                            flag = !this.m_MinDistance.hasMultipleDifferentValues && !this.m_MaxDistance.hasMultipleDifferentValues;
                            if (enumValueIndex == AudioRolloffMode.Linear)
                            {
                                curve = AnimationCurve.Linear(this.m_MinDistance.floatValue / this.m_MaxDistance.floatValue, 1f, 1f, 0.0f);
                            }
                            else if (enumValueIndex == AudioRolloffMode.Logarithmic)
                            {
                                curve = AudioSourceInspector.Logarithmic(this.m_MinDistance.floatValue / this.m_MaxDistance.floatValue, 1f, 1f);
                            }
                        }
                    }
                    else
                    {
                        flag = !audioCurve.curveProp.hasMultipleDifferentValues;
                    }
                    if (flag)
                    {
                        if (curve.length == 0)
                        {
                            Debug.LogError((object)(audioCurve.legend.text + " curve has no keys!"));
                        }
                        else
                        {
                            curveWrapperList.Add(this.GetCurveWrapper(curve, audioCurve));
                        }
                    }
                }
            }
            return(curveWrapperList.ToArray());
        }