// private float timeLastFrame; void Start() { // timeLastFrame = Time.realtimeSinceStartup; realDeltaTime = Time.deltaTime; DelayParticleSystems.Sort(Sort); DelayDestroyGameObject.Sort(Sort); if (DelayParticleSystems != null && DelayParticleSystems.Count > 0) { for (int i = 0; i < DelayParticleSystems.Count; i++) { DelayParticleSystem dps = DelayParticleSystems[i]; dps.go.SetActive(false); } StartCoroutine(UpdateSelf()); } if (DelayDestroyGameObject != null && DelayDestroyGameObject.Count > 0) { StartCoroutine(UpdateDestroyList()); } if (m_destroyTime > 0) { StartCoroutine(UpdateDestroy()); } //if (m_blIgnoreScaleTime) //{ // foreach (Animator ani in m_listAnimator) // { // ani.updateMode = AnimatorUpdateMode.UnscaledTime; // } //} }
IEnumerator UpdateSelf() { if (DelayParticleSystems != null) { for (int i = 0; i < DelayParticleSystems.Count; i++) { DelayParticleSystem dps = DelayParticleSystems[i]; while (_currentTime < dps.delayTime) { yield return(0); } dps.go.SetActive(true); } } }
IEnumerator UpdateDestroyList() { if (DelayDestroyGameObject != null) { for (int i = 0; i < DelayDestroyGameObject.Count; i++) { DelayParticleSystem dps = DelayDestroyGameObject[i]; while (_currentTime < dps.delayTime) { yield return(0); } if (dps != null) { dps.go.SetActive(false); } } } }
public int Sort(DelayParticleSystem p1, DelayParticleSystem p2) { return(p1.delayTime <= p2.delayTime?-1:1); }