IEnumerator Calcuate(ArithmeticTimePoint start, ArithmeticResult result, ArithmeticTimePoint end) { start(); float percent = 0; float time = 0; while (!stop) { if (pause) { continue; } percent = interpolator.GetInterpolation(time); if (percent > 0.999f) { percent = 1; result(percent); end(); break; } result(percent); time += (TimeKits.deltaTime() / duration); yield return(null); } if (!stop) { stop = true; end(); } yield return(null); }
public void Start(ArithmeticTimePoint start, ArithmeticResult result, ArithmeticTimePoint end) { pause = false; stop = false; CoroutineKits.StartCoroutine(Calcuate(start, result, end)); }