Beispiel #1
0
    IEnumerator DelayedLoad(int scene)
    {
        //Play the clip once
        source.PlayOneShot(select);

        float fadeTime = fade.BeginFade(1);

        //Wait until clip finish playing
        yield return(new WaitForSeconds(fadeTime));

        //Load scene here
        SceneManager.LoadScene(scene);
    }
Beispiel #2
0
    IEnumerator ChangeLevel()
    {
        FadeInOut fadeInOut = GameObject.Find("Character Main Camera").GetComponent <FadeInOut>();
        float     fadeTime  = fadeInOut.BeginFade(1);

        yield return(new WaitForSeconds(fadeTime));

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
Beispiel #3
0
 public void Restart()
 {
     fade.BeginFade(1);
     StartCoroutine(DelayedLoad(SceneManager.GetActiveScene().buildIndex));
 }