public IEnumerator Process(MonoBehaviour m, AnimationStateAction action) { bool oneLoop = true; while (oneLoop) { if (HasDelay()) { yield return(delayYield); } enterEvents.Invoke(); for (float t = 0f; t < 1f; t += Time.deltaTime / time) { if ((t + (Time.deltaTime / time)) > 1f) { t = 1f; } action(t, curve); yield return(null); } exitEvents.Invoke(); triggered = true; if (IsLoop() == false) { oneLoop = false; } } }
public IEnumerator Process(MonoBehaviour m, AnimationStep step, AnimationStateAction action) { triggered = true; bool oneLoop = true; while (oneLoop) { if (HasDelay()) { yield return(delayYield); } if (enterEvents.GetPersistentEventCount() > 0) { enterEvents.Invoke(); } for (float t = 0f; t < 1f; t += Time.deltaTime / time) { if ((t + (Time.deltaTime / time)) > 1f) { t = 1f; } action(t, speed.GetValue(), curve); if (step == AnimationStep.FixedUpdate) { yield return(fixedUpdateYield); } else { yield return(null); } } if (exitEvents.GetPersistentEventCount() > 0) { exitEvents.Invoke(); } if (IsLoop() == false) { oneLoop = false; } } }
public IEnumerator ProcessInEditor(AnimationStateAction action) { float startVal = (float)EditorApplication.timeSinceStartup; yield return(null); float t = 0; float diff = 0; while (t < 1f) { diff = (float)EditorApplication.timeSinceStartup - startVal; t += diff / time; action(t, curve); startVal = (float)EditorApplication.timeSinceStartup; yield return(null); } action(1, curve); }