예제 #1
0
 // Update is called once per frame
 private void Update()
 {
     if (wait <= 0)
     {
         view.color += new Color(0, 0, 0, 0.02f);
         if (view.color.a >= 0.95)
         {
             KeepObjects.SetActive(true);
             SceneManager.LoadScene(1);
         }
     }
     else
     {
         wait -= Time.deltaTime;
     }
 }
예제 #2
0
    /// <summary>
    /// 動態載入畫面
    /// </summary>
    /// <param name="sceneNum">目標視窗ID</param>
    /// <returns></returns>
    private IEnumerator LoadingScreenAsync(int sceneNum)
    {
        if (sceneNum == 3)
        {
            KeepObjects.SetActive(false);
        }
        else
        {
            KeepObjects.SetActive(true);
        }
        int            fPogress = 0, tPogress;
        AsyncOperation async = SceneManager.LoadSceneAsync(sceneNum);

        async.allowSceneActivation = false;
        while (async.progress < 0.9f)
        {
            tPogress = (int)(async.progress * 100);
            while (fPogress < tPogress)
            {
                fPogress = (fPogress + tPogress + 1) >> 1;
                SetLoading(fPogress);
                _animator.Play("Loading", 0, (float)fPogress / 101);
                yield return(new WaitForEndOfFrame());
            }
            yield return(null);
        }
        tPogress = 100;
        while (fPogress < tPogress)
        {
            //fPogress++;
            fPogress = (fPogress + tPogress + 1) >> 1;
            _animator.Play("Loading", 0, (float)fPogress / 101);
            SetLoading(fPogress);
            yield return(new WaitForEndOfFrame());
        }
        async.allowSceneActivation = true;
    }
예제 #3
0
 private void Start()
 {
     view       = GetComponent <Image>();
     view.color = new Color(1, 1, 1, 0);
     KeepObjects.SetActive(false);
 }