IEnumerator SceneTransition(ScenesEnum scene, float inTime, float outTime, float midTime) { InTransition = true; TransitionUI.DOFade(1, inTime); yield return(new WaitForSeconds(inTime)); switch (scene) { case ScenesEnum.menu: SceneManager.LoadScene("Menu"); break; case ScenesEnum.main: SceneManager.LoadScene("Main"); break; case ScenesEnum.levelSelect: SceneManager.LoadScene("Level Select"); break; default: Debug.LogError("No case for selected scene : " + scene.ToString()); break; } yield return(new WaitForSeconds(midTime)); TransitionUI.DOFade(0, outTime); yield return(new WaitForSeconds(outTime * 0.7f)); InTransition = false; }
IEnumerator SceneTransition(ScenesEnum scene, float inTime, float outTime, float midTime) { InTransition = true; TransitionUI.DOFade(1, inTime); yield return new WaitForSeconds(inTime); switch (scene) { case ScenesEnum.menu : SceneManager.LoadScene("Menu"); break; case ScenesEnum.main : SceneManager.LoadScene("Main"); break; case ScenesEnum.levelSelect : SceneManager.LoadScene("Level Select"); break; default : Debug.LogError("No case for selected scene : " + scene.ToString()); break; } yield return new WaitForSeconds(midTime); TransitionUI.DOFade(0, outTime); yield return new WaitForSeconds(outTime * 0.7f); InTransition = false; }
/// <summary> /// 转换场景 /// </summary> /// <param name="nextScenes"></param> /// <param name="asyncOperation"></param> public static void ChangeScenes(ScenesEnum nextScenes, out AsyncOperation asyncOperation) { asyncOperation = SceneManager.LoadSceneAsync(nextScenes.ToString()); }
/// <summary> /// 转换场景 /// </summary> public static void ChangeScenes(ScenesEnum nextScenes) { SceneManager.LoadScene(nextScenes.ToString()); currentScenes = nextScenes; }