コード例 #1
0
 /// <summary>
 /// Sets up all visual elements, fades from black at the start
 /// </summary>
 protected virtual void LoadingSetup()
 {
     MMFadeOutEvent.Trigger(StartFadeDuration, _tween);
     LoadingCompleteAnimation.alpha = 0;
     LoadingProgressBar.GetComponent <Image>().fillAmount = 0f;
     LoadingText.text = _loadingTextValue;
 }
コード例 #2
0
        /// <summary>
        /// Requests a fade on exit
        /// </summary>
        /// <returns></returns>
        protected virtual IEnumerator ExitFade()
        {
            SetAudioListener(false);
            if (_exitFadeDuration > 0f)
            {
                MMLoadingSceneDebug("MMLoadingSceneManagerAdditive : exit fade, duration : " + _exitFadeDuration);
                MMSceneLoadingManager.LoadingSceneEvent.Trigger(_sceneToLoadName, MMSceneLoadingManager.LoadingStatus.ExitFade);
                OnExitFade?.Invoke();

                if (_fadeMode == FadeModes.FadeOutThenIn)
                {
                    MMFadeInEvent.Trigger(_exitFadeDuration, _exitFadeTween, FaderID, true);
                }
                else
                {
                    MMFadeOutEvent.Trigger(_exitFadeDuration, _exitFadeTween, FaderID, true);
                }
                yield return(MMCoroutine.WaitForUnscaled(_exitFadeDuration));
            }
        }
コード例 #3
0
        /// <summary>
        /// Loads the scene to load asynchronously.
        /// </summary>
        protected virtual IEnumerator LoadAsynchronously()
        {
            // we setup our various visual elements
            LoadingSetup();

            // we fade from black
            MMFadeOutEvent.Trigger(StartFadeDuration, _tween);
            yield return(new WaitForSeconds(StartFadeDuration));

            // we start loading the scene
            _asyncOperation = SceneManager.LoadSceneAsync(_sceneToLoad, LoadSceneMode.Single);
            _asyncOperation.allowSceneActivation = false;

            // while the scene loads, we assign its progress to a target that we'll use to fill the progress bar smoothly
            while (_asyncOperation.progress < 0.9f)
            {
                _fillTarget = _asyncOperation.progress;
                yield return(null);
            }
            // when the load is close to the end (it'll never reach it), we set it to 100%
            _fillTarget = 1f;

            // we wait for the bar to be visually filled to continue
            while (_progressBarImage.fillAmount != _fillTarget)
            {
                yield return(null);
            }

            // the load is now complete, we replace the bar with the complete animation
            LoadingComplete();
            yield return(new WaitForSeconds(LoadCompleteDelay));

            // we fade to black
            MMFadeInEvent.Trigger(ExitFadeDuration, _tween);
            yield return(new WaitForSeconds(ExitFadeDuration));

            // we switch to the new scene
            _asyncOperation.allowSceneActivation = true;
            LoadingSceneEvent.Trigger(_sceneToLoad, LoadingStatus.LoadTransitionComplete);
        }
コード例 #4
0
        /// <summary>
        /// Calls a fader on entry
        /// </summary>
        /// <returns></returns>
        protected virtual IEnumerator EntryFade()
        {
            if (_entryFadeDuration > 0f)
            {
                MMLoadingSceneDebug("MMLoadingSceneManagerAdditive : entry fade, duration : " + _entryFadeDuration);
                MMSceneLoadingManager.LoadingSceneEvent.Trigger(_sceneToLoadName, MMSceneLoadingManager.LoadingStatus.EntryFade);
                OnEntryFade?.Invoke();

                if (_fadeMode == FadeModes.FadeOutThenIn)
                {
                    yield return(null);

                    MMFadeOutEvent.Trigger(_entryFadeDuration, _entryFadeTween, FaderID, true);
                }
                else
                {
                    yield return(null);

                    MMFadeInEvent.Trigger(_entryFadeDuration, _entryFadeTween, FaderID, true);
                }

                yield return(MMCoroutine.WaitFor(_entryFadeDuration));
            }
        }
コード例 #5
0
 /// <summary>
 /// Test method triggered by an inspector button
 /// </summary>
 protected virtual void FadeOut1Second()
 {
     MMFadeOutEvent.Trigger(1f, DefaultTween, ID, IgnoreTimescale, DebugWorldPositionTarget.transform.position);
 }
コード例 #6
0
ファイル: MMFader.cs プロジェクト: Kurakurture/need-more-deep
 /// <summary>
 /// Test method triggered by an inspector button
 /// </summary>
 protected virtual void FadeOut1Second()
 {
     MMFadeOutEvent.Trigger(1f, new MMTweenType(MMTween.MMTweenCurve.LinearTween));
 }
コード例 #7
0
 /// <summary>
 /// Test method triggered by an inspector button
 /// </summary>
 protected virtual void FadeOut1Second()
 {
     MMFadeOutEvent.Trigger(1f);
 }