private IEnumerator InternalFadeIn() { transitioning = true; RectTransform rect = GetComponent <RectTransform>(); const float kLength = 0.2f; const float kMovement = 100f; for (float time = 0f; time < kLength; time += Time.deltaTime) { float progress = time / kLength; currentGroup.alpha = progress; rect.anchoredPosition = new Vector2( 0f, PanelTransitioner.Damp(-kMovement, 0f, progress)); yield return(null); } currentGroup.alpha = 1f; rect.anchoredPosition = Vector2.zero; transitioning = false; if (defaultSelected != null) { EventSystem.current.SetSelectedGameObject(defaultSelected); } }
private IEnumerator InternalFadeOut() { transitioning = true; RectTransform rect = GetComponent <RectTransform>(); const float kLength = 0.2f; const float kMovement = 100f; for (float time = 0f; time < kLength; time += Time.deltaTime) { float progress = time / kLength; currentGroup.alpha = 1f - progress; rect.anchoredPosition = new Vector2( 0f, PanelTransitioner.Damp(0f, -kMovement, progress)); yield return(null); } currentGroup.alpha = 0f; previousGroup.interactable = true; EventSystem.current.SetSelectedGameObject(previousSelected); transitioning = false; gameObject.SetActive(false); }