Exemple #1
0
        private IEnumerator Transition()
        {
            DontDestroyOnLoad(gameObject);

            Fader fader = FindObjectOfType <Fader>();


            yield return(fader.FadeOut(fadeOutTime));

            SavingWrapper wrapper = FindObjectOfType <SavingWrapper>();

            wrapper.Save();

            yield return(SceneManager.LoadSceneAsync(SceneToLoad));

            wrapper.Load();

            Portal otherPortal = GetOtherPortal();

            UpdatePlayer(otherPortal);

            wrapper.Save();

            yield return(new WaitForSeconds(fadeWaitTime));

            yield return(fader.FadeIn(fadeInTime));

            Destroy(gameObject);
        }
Exemple #2
0
        private IEnumerator Transition( )
        {
            if (sceneToLoad < 0)
            {
                Debug.Log("Scene to load not set");
                yield break;
            }

            DontDestroyOnLoad(gameObject);
            _fader = FindObjectOfType <Fader>( );
            if (!_fader)
            {
                Debug.Log("fader not found!");
            }
            yield return(_fader.FadeOut(fadeOutTime));

            _saver.Save( );
            yield return(SceneManager.LoadSceneAsync(sceneToLoad));

            _saver.Load( );

            Portal otherPortal = GetOtherPortal( );

            UpdatePlayer(otherPortal);
            //save again as a checkpoint after initial loading
            _saver.Save( );

            yield return(new WaitForSeconds(fadeInTime));

            yield return(_fader.FadeIn(fadeInTime));

            Destroy(gameObject);
        }
Exemple #3
0
        private IEnumerator Transition()
        {
            DontDestroyOnLoad(gameObject);
            onLoadStart?.Invoke();
            yield return(loadScreen.LoadScreenIn(timeIn));

            savingWrapper.Save();
            yield return(SceneManager.LoadSceneAsync(numberOfLoadScene));

            onLoadStart?.Invoke();

            savingWrapper.Load();
            PlayerPositionUpdate(GetSpawnPoint());
            savingWrapper.Save();

            yield return(new WaitForSeconds(loadScreenWait));

            onLoadEnd?.Invoke();
            yield return(loadScreen.LoadScreenOut(timeOut));

            Destroy(gameObject);
        }
Exemple #4
0
        private IEnumerator Transition()
        {
            if (sceneToLoad == " ")
            {
                Debug.LogError("scene to load not set");
                yield break;
            }
            DontDestroyOnLoad(gameObject);

            Fader            fader            = FindObjectOfType <Fader>();
            SavingWrapper    wrapper          = FindObjectOfType <SavingWrapper>();
            PlayerController playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();

            playerController.enabled = false;

            yield return(fader.FadeOut(fadeOutTime));

            wrapper.Save();
            yield return(SceneManager.LoadSceneAsync(sceneToLoad));

            PlayerController newPlayerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();

            newPlayerController.enabled = false;
            wrapper.Load();

            ScenePortal otherScenePortal = GetOtherPortal();

            UpdatePlayer(otherScenePortal);
            wrapper.Save();

            yield return(new WaitForSeconds(fadeWaitTime));

            fader.FadeIn(fadeInTime);
            newPlayerController.enabled = true;

            Destroy(gameObject);
        }
Exemple #5
0
        private void LoadScene()
        {
            SavingWrapper savingWrapper = GetSavingWrapper();

            savingWrapper.Load();
        }