public void MoveToNextScene() { transitioning = SceneTransitionState.Processing; endSceneAnimation.SetBool("next_scene", true); canvasGroup.blocksRaycasts = true; Camera.main.GetComponent <AudioSource>().Stop(); audioStart.Play(); StartCoroutine("LoadNextScene"); }
private void Update() { switch (m_state) { case SceneTransitionState.Idle: { break; } case SceneTransitionState.Filling: { var fadeSpeed = 1.0f / m_fadeTime; var color = m_image.color; if (color.a >= 1.0f) { m_state = SceneTransitionState.Fading; SceneManager.LoadScene(m_sceneName); return; } color.a += Time.deltaTime * fadeSpeed; m_image.color = color; break; } case SceneTransitionState.Fading: { var fadeSpeed = 1.0f / m_fadeTime; var color = m_image.color; if (color.a <= 0.0f) { Instance.GetComponent <GraphicRaycaster>().enabled = false; m_state = SceneTransitionState.Idle; return; } color.a -= Time.deltaTime * fadeSpeed; m_image.color = color; break; } } }
private IEnumerator LoadNextScene() { yield return(new WaitForSeconds(3f)); AsyncOperation changeScene = SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1); yield return(new WaitForSeconds(0.3f)); endSceneAnimation.SetBool("next_scene", false); canvasGroup.blocksRaycasts = false; audioEnd.Play(); yield return(new WaitForSeconds(1f)); transitioning = SceneTransitionState.None; if (SceneManager.GetActiveScene().name == "Game" && AchievementManager.Instance) { AchievementManager.Instance.CollectAchievement("Tutorial"); } }
void _SceneTransitionCallback(SceneTransitionState transition_state, string scene_name) { Debug.Log(transition_state); }