private IEnumerator Interpolator(GraphicRow row) { float maxTime = curve.keys[curve.length - 1].time + row.waitTime; float valPrevious = 0f; float time = 0f; while (time < maxTime) { time += Time.deltaTime * interpSpeed; time = Mathf.Min(maxTime, time); var val = curve.Evaluate(time) * row.intensityFactor; if (Mathf.Approximately(val, valPrevious) == false) { row.graphic.materialForRendering.SetFloat(_shaderValueID, val); row.graphic.materialForRendering.SetFloat(_shaderNormalizedTimeID, time / maxTime * row.graphic.color.a); } valPrevious = val; yield return(null); } if (setMaterialToNull) { row.graphic.material = null; } }
private IEnumerator Adder(GraphicRow row) { if (row.graphic != null && row.graphic.gameObject.activeInHierarchy) { if (row.waitTime > 0f) { row.graphic.material = new Material(material); yield return(new WaitForSeconds(row.waitTime)); } else { row.graphic.material = material; } StartCoroutine(Interpolator(row)); } }