0-1(normalizedTime)转化为0-1-0的曲线
yOffset 的值是从0,到height,再到0
public class TempToTest : MonoBehaviour
{
void Start ()
{
StartCoroutine(Parabola(1, 1));
}
void Update ()
{
}
IEnumerator Parabola(float height, float duration)
{
float normalizedTime = 0.0f;
while (normalizedTime < 1.0f)
{
float yOffset = height * 4.0f * (normalizedTime - normalizedTime * normalizedTime);
normalizedTime += Time.deltaTime / duration;
Debug.Log(yOffset);
yield return null;
}
}
}