Esempio n. 1
0
    private IEnumerator FadeIn()
    {
        GameObject fadeCanvas = Instantiate(Resources.Load <GameObject> ("UI/FadeCanvas"));

        fadePanel       = fadeCanvas.transform.GetChild(0).GetComponent <Image> ();
        fadeTime        = Time.deltaTime;
        fadePanel.color = new Color(0, 0, 0, 1);
        while (fadePanel.color.a > 0)
        {
            fadePanel.color -= new Color(0, 0, 0, (float)fadeValue * fadeTime);
            yield return(null);
        }
        fadePanel = null;
        Destroy(fadeCanvas);
        fadeTime = 0;
        if (SceneManager.GetActiveScene().name == "LoadingScene")
        {
            if (!loadingScene)
            {
                loadingScene = GameObject.Find("LoadingSceneManager").GetComponent <LoadingSceneUI> ();
            }
            AsyncOperation asyncScene = SceneManager.LoadSceneAsync(sceneIndex);

            while (!asyncScene.isDone)
            {
                loadingScene.LoadingProcess(asyncScene.progress);
                yield return(null);
            }
        }
    }