Exemplo n.º 1
0
        private IEnumerator TransitionCoroutine(
            GameScenes nextScene,
            SceneDataPack data,
            GameScenes[] additiveLoadScenes,
            bool autoMove
            )
        {
            ToMoveFlag.Value       = autoMove;
            _isTransitioning.Value = true;
            while (transitionComponent == null)
            {
                yield return(new WaitForSeconds(0.2f));

                transitionComponent.threshold = 0;
            }
            //タッチイベントを吸収させる
            image.raycastTarget      = true;
            transitionComponent.flip = false;
            transitionComponent.Play();
            yield return(onTransactionFinishedInternal.FirstOrDefault().StartAsCoroutine());

            transitionComponent.threshold = 1;

            SceneLoader.PreviousSceneData = data;

            //シーン遷移
            yield return(SceneManager.LoadSceneAsync(nextScene.ToString(), LoadSceneMode.Single));

            //追加シーンがある場合は一緒に読み込む
            if (additiveLoadScenes != null)
            {
                yield return(additiveLoadScenes.Select(scene =>
                                                       SceneManager.LoadSceneAsync(scene.ToString(), LoadSceneMode.Additive)
                                                       .ObserveEveryValueChanged(x => x.isDone)
                                                       .FirstOrDefault(x => x)
                                                       ).WhenAll().StartAsCoroutine());
            }
            Resources.UnloadUnusedAssets();
            GC.Collect();

            onAllSceneLoaded.OnNext(Unit.Default);
            if (!autoMove)
            {
                //自動遷移しないなら待機
                yield return(ToMoveFlag.FirstOrDefault(x => x).StartAsCoroutine());
            }
            ToMoveFlag.Value = false;

            //反転
            transitionComponent.Play();
            yield return(onTransactionFinishedInternal.FirstOrDefault().StartAsCoroutine());

            image.raycastTarget           = false;
            transitionComponent.threshold = 0;
            onTransitionAnimationFinishedSubject.OnNext(Unit.Default);
            _isTransitioning.Value = false;
        }
Exemplo n.º 2
0
 public void OnStartAnimation()
 {
     transition1.Play();
     transition2.Play();
 }
Exemplo n.º 3
0
 public void PlayTransitionInEffect()
 {
     m_TransitionInEffect.Play();
 }