Example #1
0
        protected void SetEnteringGameObjectLocation(SceneTransitionDestination entrance)
        {
            if (entrance == null)
            {
                Debug.LogWarning("Entering Transform's location has not been set.");
                return;
            }
            Transform entranceLocation  = entrance.transform;
            Transform enteringTransform = entrance.transitioningGameObject.transform;

            enteringTransform.position = entranceLocation.position;
            enteringTransform.rotation = entranceLocation.rotation;
        }
Example #2
0
        protected void SetupNewScene(TransitionPoint.TransitionType transitionType, SceneTransitionDestination entrance)
        {
            if (entrance == null)
            {
                Debug.LogWarning("Restart information has not been set.");
                return;
            }

            if (transitionType == TransitionPoint.TransitionType.DifferentZone)
            {
                SetZoneStart(entrance);
            }
        }
Example #3
0
        protected IEnumerator Transition(string newSceneName, SceneTransitionDestination.DestinationTag destinationTag, TransitionPoint.TransitionType transitionType = TransitionPoint.TransitionType.DifferentZone)
        {
            m_Transitioning = true;
            PersistentDataManager.SaveAllData();

            if (m_PlayerInput == null)
            {
                m_PlayerInput = FindObjectOfType <PlayerMyController>();
            }
            if (m_PlayerInput)
            {
                m_PlayerInput.ReleaseControl();
            }
            yield return(StartCoroutine(ScreenFader.FadeSceneOut(ScreenFader.FadeType.Loading)));

            PersistentDataManager.ClearPersisters();
            yield return(SceneManager.LoadSceneAsync(newSceneName));

            m_PlayerInput = FindObjectOfType <PlayerMyController>();
            if (m_PlayerInput)
            {
                m_PlayerInput.ReleaseControl();
            }
            PersistentDataManager.LoadAllData();
            SceneTransitionDestination entrance = GetDestination(destinationTag);

            SetEnteringGameObjectLocation(entrance);
            SetupNewScene(transitionType, entrance);
            if (entrance != null)
            {
                entrance.OnReachDestination.Invoke();
            }
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

            if (m_PlayerInput)
            {
                m_PlayerInput.GainControl();
            }

            m_Transitioning = false;
        }
Example #4
0
 protected void SetZoneStart(SceneTransitionDestination entrance)
 {
     m_CurrentZoneScene          = entrance.gameObject.scene;
     m_ZoneRestartDestinationTag = entrance.destinationTag;
 }