private IEnumerator Switch(GameObject currentPanel, GameObject nextPanel, float fadein, float fadeout) { PanelFade2 current = currentPanel.GetComponent <PanelFade2>(), next = nextPanel.GetComponent <PanelFade2>(); current.Close(fadeout); yield return(new WaitForSeconds(fadeout + 1f)); nextPanel.SetActive(true); next.Open(fadein); }
private IEnumerator Switch(GameObject currentPanel, GameObject nextPanel, float fadein, float fadeout) { PanelFade2 current = currentPanel.GetComponent <PanelFade2>(), next = nextPanel.GetComponent <PanelFade2>(); Debug.Log("AvgPanelSwitch 进入coroutine"); if (current != null) { current.Close(fadeout); yield return(new WaitForSeconds(fadeout + 1f)); } //nextPanel.SetActive(true); next.Open(fadein); }