protected IEnumerator _Hide(float waitTime) { if (isVisible == false) { yield break; } yield return(StartCoroutine(CoroutineUtility.WaitRealtime(waitTime))); DoHide(); }
protected IEnumerator _Show(float waitTime) { if (isVisible) { yield break; } // Show default page before wait is completed, otherwise it'd pop in after time. if (defaultPage != null) { defaultPage.Show(); } yield return(StartCoroutine(CoroutineUtility.WaitRealtime(waitTime))); DoShow(); }
/// <summary> /// Hides object after animation is completed. /// </summary> protected IEnumerator _PlayAnimationAndDisableAnimator(float waitTime, int hash, Action callback) { yield return(null); // Needed for some reason, Unity bug?? var before = _animationCoroutine; animator.enabled = true; animator.Play(hash); yield return(StartCoroutine(CoroutineUtility.WaitRealtime(waitTime))); // If action completed without any other actions overriding isVisible should be true. It could be hidden before the coroutine finished. animator.enabled = false; if (callback != null) { callback(); } if (before == _animationCoroutine) { // Didn't change curing coroutine _animationCoroutine = null; } }