private static IEnumerator ChangeDiamondMiddleHeight(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration) { float startValue = shape.GetDiamondMiddleHeight(); float timeElapsed = 0; while (timeElapsed < duration) { float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration); shape.SetDiamondMiddleHeight(newvalue, true); yield return(new WaitForEndOfFrame()); timeElapsed += Time.deltaTime; } shape.SetDiamondMiddleHeight(endValue, true); }