IEnumerator ClosePause() { pauseopen = false; int length = 40; float a = 150f / length; float b = 1f / length; for (int i = 0; i < length; i++) { PauseWindow.transform.localPosition = new Vector3(PauseWindow.transform.localPosition.x, 0f - a * i, PauseWindow.transform.localPosition.z); PauseGroup.alpha = b * (length - i - 3); yield return(new WaitForEndOfFrame()); } PauseWindow.SetActive(false); }
IEnumerator OpenPause() { pauseopen = true; int length = 40; float a = 150f / length; float b = 1f / length; PauseWindow.SetActive(true); for (int i = length; i > 0; i--) { PauseWindow.transform.localPosition = new Vector3(PauseWindow.transform.localPosition.x, 0f - a * i, PauseWindow.transform.localPosition.z); PauseGroup.alpha = b * (length - i - 3); yield return(new WaitForEndOfFrame()); } }