Version: 2020.1

# MinMaxCurve

struct in UnityEngine

## 描述

```using UnityEngine;// This example shows setting a constant rate value.
public class ConstantRateExample : MonoBehaviour
{
ParticleSystem myParticleSystem;
ParticleSystem.EmissionModule emissionModule;    void Start()
{
// Get the system and the emission module.
myParticleSystem = GetComponent<ParticleSystem>();
emissionModule = myParticleSystem.emission;        GetValue();
SetValue();
}    void GetValue()
{
print("The constant value is " + emissionModule.rate.constant);
}    void SetValue()
{
emissionModule.rate = 10.0f;
}
}
```
```using UnityEngine;// This example shows using 2 constants to drive the rate.
public class TwoConstantsRateExample : MonoBehaviour
{
ParticleSystem myParticleSystem;
ParticleSystem.EmissionModule emissionModule;    void Start()
{
// Get the system and the emission module.
myParticleSystem = GetComponent<ParticleSystem>();
emissionModule = myParticleSystem.emission;        GetValue();
SetValue();
}    void GetValue()
{
print(string.Format("The constant values are: min {0} max {1}.", emissionModule.rate.constantMin, emissionModule.rate.constantMax));
}    void SetValue()
{
emissionModule.rate = new ParticleSystem.MinMaxCurve(0.0f, 10.0f);
}
}
```
```using UnityEngine;// This example shows using a curve to drive the rate.
public class CurveRateExample : MonoBehaviour
{
ParticleSystem myParticleSystem;
ParticleSystem.EmissionModule emissionModule;    // We can "scale" the curve with this value. It gets multiplied by the curve.
public float scalar = 1.0f;    AnimationCurve ourCurve;    void Start()
{
// Get the system and the emission module.
myParticleSystem = GetComponent<ParticleSystem>();
emissionModule = myParticleSystem.emission;        // A simple linear curve.
ourCurve = new AnimationCurve();
ourCurve.AddKey(1.0f, 1.0f);        // Apply the curve.
emissionModule.rate = new ParticleSystem.MinMaxCurve(scalar, ourCurve);        // In 5 seconds we will modify the curve.
Invoke("ModifyCurve", 5.0f);
}    void ModifyCurve()
{
// Add a key to the current curve.
ourCurve.AddKey(0.5f, 0.0f);        // Apply the changed curve.
emissionModule.rate = new ParticleSystem.MinMaxCurve(scalar, ourCurve);
}
}
```
```using UnityEngine;// This example shows using 2 curves to drive the rate.
public class TwoCurveRateExample : MonoBehaviour
{
ParticleSystem myParticleSystem;
ParticleSystem.EmissionModule emissionModule;    AnimationCurve ourCurveMin;
AnimationCurve ourCurveMax;    // We can "scale" the curves with this value. It gets multiplied by the curves.
public float scalar = 1.0f;    void Start()
{
// Get the system and the emission module.
myParticleSystem = GetComponent<ParticleSystem>();
emissionModule = myParticleSystem.emission;        // A horizontal straight line at value 1.
ourCurveMin = new AnimationCurve();
ourCurveMin.AddKey(1.0f, 1.0f);        // A horizontal straight line at value 0.5.
ourCurveMax = new AnimationCurve();
ourCurveMax.AddKey(1.0f, 0.5f);        // Apply the curves.
emissionModule.rate = new ParticleSystem.MinMaxCurve(scalar, ourCurveMin, ourCurveMax);        // In 5 seconds we will modify the curve.
Invoke("ModifyCurve", 5.0f);
}    void ModifyCurve()
{
// Create a "pinch" point.
ourCurveMax.AddKey(0.5f, 0.6f);        // Apply the changed curve.
emissionModule.rate = new ParticleSystem.MinMaxCurve(scalar, ourCurveMin, ourCurveMax);
}
}
```

## 变量

 constant 设置常量值。 constantMax 为上限设置常量。 constantMin 为下限设置常量。 curve 设置曲线。 curveMax 为上限设置曲线。 curveMin 为下限设置曲线。 curveMultiplier 设置要应用于曲线的乘数。 mode 设置模式，最小值-最大值曲线使用该模式计算值。

## 构造函数

 ParticleSystem.MinMaxCurve 用于整个曲线的单个常量值。

## 公共函数

 Evaluate 手动查询曲线以基于所处模式计算值。