void Update() { if (mState == EState.Warmup) { mElapsedTime += Time.deltaTime; if (mElapsedTime >= 2f) { mState = EState.Fly; Model.gameObject.SetActive(true); Model.transform.localPosition = Vector3.zero; Comet.Active(); mElapsedTime = 0f; } } else if (mState == EState.Fly) { Vector3 curPos = Model.transform.position; curPos.z -= Time.deltaTime * 400f; Model.transform.position = curPos; mElapsedTime += Time.deltaTime; if (mElapsedTime > 0.6f) { mState = EState.End; Comet.StopSmoothly(0.4f); Model.gameObject.SetActive(false); Comet_Explode.transform.position = Model.transform.position; Comet_Explode.Active(); } } }
public void StopEffect(string eftName, float fadeTime) { List <XffectComponent> cache = EffectDic[eftName]; if (cache == null) { Debug.LogError(name + ": cache doesnt exist!"); return; } for (int i = 0; i < cache.Count; i++) { XffectComponent xft = cache[i]; if (!XffectComponent.IsActive(xft.gameObject)) { continue; } xft.StopSmoothly(fadeTime); } }