public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor = true)
{
if (!this.stateHasMultipleDifferentValues)
{
if (newState == this.state)
{
return;
}
}
MinMaxCurveState state = this.state;
ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();
if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
{
particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
}
switch (newState)
{
case MinMaxCurveState.k_Scalar:
this.InitSingleScalar(state);
break;
case MinMaxCurveState.k_Curve:
this.InitSingleCurve(state);
break;
case MinMaxCurveState.k_TwoCurves:
this.InitDoubleCurves(state);
break;
case MinMaxCurveState.k_TwoScalars:
this.InitDoubleScalars(state);
break;
}
this.minMaxState.intValue = (int)newState;
if (addToCurveEditor)
{
switch (newState)
{
case MinMaxCurveState.k_Scalar:
case MinMaxCurveState.k_TwoScalars:
break;
case MinMaxCurveState.k_Curve:
case MinMaxCurveState.k_TwoCurves:
particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
break;
default:
Debug.LogError("Unhandled enum value");
break;
}
}
AnimationCurvePreviewCache.ClearCache();
}