public void StopSmoothly(float fadeTime) { mStopped = true; emitter.StopEmit(); for (int i = 0; i < MaxENodes; i++) { EffectNode node = ActiveENodes[i]; if (node == null) { continue; } if (!IsNodeLifeLoop && node.GetLifeTime() < fadeTime) { fadeTime = node.GetLifeTime() - node.GetElapsedTime(); } node.Fade(fadeTime); } }
//consider node life if TimeLen < 0; public float Evaluate(float time, EffectNode node) { float len = TimeLen; if (len < 0f) { len = node.GetLifeTime(); } float t = time / len; if (t > 1f) { if (WrapType == WRAP_TYPE.CLAMP) { t = 1f; } else if (WrapType == WRAP_TYPE.LOOP) { int d = Mathf.FloorToInt(t); t = t - (float)d; } else { int n = Mathf.CeilToInt(t); int d = Mathf.FloorToInt(t); if (n % 2 == 0) { t = (float)n - t; } else { t = t - (float)d; } } } return(Curve01.Evaluate(t) * MaxValue); }
//consider node life if TimeLen < 0; public float Evaluate(float time, EffectNode node) { float len = TimeLen; if (len < 0f) len = node.GetLifeTime(); float t = time / len; if (t > 1f) { if (WrapType == WRAP_TYPE.CLAMP) { t = 1f; } else if (WrapType == WRAP_TYPE.LOOP) { int d = Mathf.FloorToInt(t); t = t - (float)d; } else { int n = Mathf.CeilToInt(t); int d = Mathf.FloorToInt(t); if (n % 2 == 0) { t = (float)n - t; } else { t = t - (float)d; } } } return Curve01.Evaluate(t) * MaxValue; }