partial void OnClicked(int component) { Vector2Distribution distribution = Value; if (DistributionType == PropertyDistributionType.Curve) { AnimationCurve[] curves = AnimationUtility.SplitCurve2D(distribution.GetMinCurve()); if (component < curves.Length) { CurveEditorWindow.Show(curves[component], (success, curve) => { if (!success) { return; } curves[component] = curve; Vector2Curve compoundCurve = AnimationUtility.CombineCurve2D(curves); Value = new Vector2Distribution(compoundCurve); OnChanged?.Invoke(); OnConfirmed?.Invoke(); }); } } else if (DistributionType == PropertyDistributionType.RandomCurveRange) { AnimationCurve[] minCurves = AnimationUtility.SplitCurve2D(distribution.GetMinCurve()); AnimationCurve[] maxCurves = AnimationUtility.SplitCurve2D(distribution.GetMaxCurve()); if (component < minCurves.Length && component < maxCurves.Length) { CurveEditorWindow.Show(minCurves[component], maxCurves[component], (success, minCurve, maxCurve) => { if (!success) { return; } minCurves[component] = minCurve; maxCurves[component] = maxCurve; Vector2Curve minCompoundCurves = AnimationUtility.CombineCurve2D(minCurves); Vector2Curve maxCompoundCurves = AnimationUtility.CombineCurve2D(maxCurves); Value = new Vector2Distribution(minCompoundCurves, maxCompoundCurves); OnChanged?.Invoke(); OnConfirmed?.Invoke(); }); } } }
private static extern void Internal_TDistribution3(Vector2Distribution managedInstance, Vector2Curve minCurve, Vector2Curve maxCurve);
private static extern void Internal_TDistribution2(Vector2Distribution managedInstance, Vector2Curve curve);
/// <summary>Creates a new distribution that returns a random value in a range determined by two curves.</summary> public Vector2Distribution(Vector2Curve minCurve, Vector2Curve maxCurve) { Internal_TDistribution3(this, minCurve, maxCurve); }
/// <summary>Creates a new distribution that evaluates a curve.</summary> public Vector2Distribution(Vector2Curve curve) { Internal_TDistribution2(this, curve); }
/// <summary>Constructs a new named animation curve.</summary> /// <param name="name">Name of the curve.</param> /// <param name="flags">Flags that describe the animation curve.</param> /// <param name="curve">Curve containing the animation data.</param> public NamedVector2Curve(string name, AnimationCurveFlags flags, Vector2Curve curve) { this.name = name; this.flags = (AnimationCurveFlags)0; this.curve = curve; }
private static extern AnimationCurve[] Internal_splitCurve2D(Vector2Curve compoundCurve);
/// <summary>Splits a Vector2 curve into two individual curves, one for each component.</summary> public static AnimationCurve[] SplitCurve2D(Vector2Curve compoundCurve) { return(Internal_splitCurve2D(compoundCurve)); }
private static extern void Internal_TAnimationCurve(Vector2Curve managedInstance, KeyFrameVec2[] keyframes);