コード例 #1
0
    IEnumerator TransitionToScene(ChangeSceneData data)
    {
        float counter = 0f;

        while (counter < duration)
        {
            counter     += Time.deltaTime;
            canvas.alpha = Mathf.Lerp(0, 1.0f, counter / duration);
            yield return(null);
        }
        //yield return new WaitForSeconds(3.0f);
        //Load Scene
        exitName    = data.exitName;
        sceneToLoad = data.sceneName;
        if (sceneToLoad == "Gym")
        {
            //couragebar.cs
            LevelEvent.onGetToLastScene.Invoke();
        }
        SceneManager.LoadScene(data.sceneName);
        counter = 0f;
        while (counter < duration)
        {
            counter     += Time.deltaTime;
            canvas.alpha = Mathf.Lerp(1.0f, 0, counter / duration);
            yield return(null);
        }
    }
コード例 #2
0
 public void OnEnteredExitTrigger(ChangeSceneData data)
 {
     StartCoroutine(TransitionToScene(data));
 }