UnityEditor.EulerCurveCombinedRenderer.GetBounds C# (CSharp) Method

GetBounds() public method

public GetBounds ( float minTime, float maxTime, int component ) : Bounds
minTime float
maxTime float
component int
return Bounds
        public Bounds GetBounds(float minTime, float maxTime, int component)
        {
            this.CalculateCurves(minTime, maxTime);
            float positiveInfinity = float.PositiveInfinity;
            float negativeInfinity = float.NegativeInfinity;
            foreach (KeyValuePair<float, Vector3> pair in this.points)
            {
                if (pair.Value[component] > negativeInfinity)
                {
                    negativeInfinity = pair.Value[component];
                }
                if (pair.Value[component] < positiveInfinity)
                {
                    positiveInfinity = pair.Value[component];
                }
            }
            if (positiveInfinity == float.PositiveInfinity)
            {
                positiveInfinity = 0f;
                negativeInfinity = 0f;
            }
            return new Bounds(new Vector3((maxTime + minTime) * 0.5f, (negativeInfinity + positiveInfinity) * 0.5f, 0f), new Vector3(maxTime - minTime, negativeInfinity - positiveInfinity, 0f));
        }

Usage Example

示例#1
0
 public Bounds GetBounds(float minTime, float maxTime)
 {
     return(renderer.GetBounds(minTime, maxTime, component));
 }