IEnumerator Out(SCENE_RAVEL next, float sec) { GameObject temp = Instantiate(m_fadeEffect); temp.transform.parent = transform; yield return(new WaitForSeconds(sec)); FadeManager.Instance.LoadLevel(next, 0.5f, null); }
/// <summary> /// シーン遷移用コルーチン . /// </summary> /// <param name='scene'>シーン名</param> /// <param name='interval'>暗転にかかる時間(秒)</param> private IEnumerator TransScene(SCENE_RAVEL scene, float interval) { //だんだん暗く . //GameObject.Find("EventSystem").GetComponent<EventSystem>().enabled = false; m_nowScene.FadeOutBefore(); this.isFading = true; float time = 0; while (time <= interval) { this.fadeAlpha = Mathf.Lerp(0f, 1f, time / interval); time += Time.deltaTime; yield return(0); } m_nowScene.FadeOutAfter(); //シーン切替 . //Application.LoadLevel (scene); Debug.Log("buildID = " + scene); Destroy(m_nowScene.gameObject); m_nowScene = Instantiate(m_scenes[(int)scene]); m_nowScene.name = m_sceneNames[(int)scene]; m_nowScene.transform.parent = transform; SceneManager.LoadScene(m_sceneNames[(int)scene]); // Pauser.Pause(); //だんだん明るく . m_nowScene.FadeInBefore(); time = 0; while (time <= interval) { this.fadeAlpha = Mathf.Lerp(1f, 0f, time / interval); time += Time.deltaTime; yield return(0); } m_nowScene.FadeInAfter(); //GameObject.Find("EventSystem").GetComponent<EventSystem>().enabled = true; this.isFading = false; }
/// <summary> /// 画面遷移 . /// </summary> /// <param name='scene'>シーン名</param> /// <param name='interval'>暗転にかかる時間(秒)</param> /// <prama name= ''> public void LoadScene(SCENE_RAVEL scene, float interval, Texture texture) { m_texture = texture; m_nowIndex = scene; StartCoroutine(TransSceneID(interval)); }