public void LoadSceneAsync(string loadSceneName, Color fadeColor, Action <float> loading, float duration = 1.0f)
        {
            FadeOut(duration, fadeColor, () =>
            {
                AsyncOperation asyncOperation = LoadSceneAsync(loadSceneName);
                bool isDone = false;
                KKUtilities.While(() =>
                {
                    if (loading != null)
                    {
                        loading.Invoke(asyncOperation.progress);
                    }
                    isDone = asyncOperation.isDone;
                    //ロードが終わったらフェードアウトする
                    if (isDone)
                    {
                        FadeIn(duration, fadeColor);
                    }

                    return(!isDone);
                }, this);
            });
        }
Exemple #2
0
 /// <summary>
 /// 1フレームに1回actionを実行する(updateの戻り値は継続するか?)
 /// </summary>
 public static Coroutine While(this MonoBehaviour mono, Func <bool> update)
 {
     return(mono.StartCoroutine(KKUtilities.While(update)));
 }