protected IEnumerator Transition(GameObject transitioningGameObject, bool releaseControl, Vector3 destinationPosition, bool fade) { m_Transitioning = true; if (releaseControl) { if (m_PlayerInput == null) { m_PlayerInput = FindObjectOfType <PlayerMyController>(); } m_PlayerInput.ReleaseControl(); } if (fade) { yield return(StartCoroutine(ScreenFader.FadeSceneOut())); } transitioningGameObject.transform.position = destinationPosition; if (fade) { yield return(StartCoroutine(ScreenFader.FadeSceneIn())); } if (releaseControl) { m_PlayerInput.GainControl(); } m_Transitioning = false; }
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; }