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); }
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); }
private void LoadScene() { SavingWrapper savingWrapper = GetSavingWrapper(); savingWrapper.Load(); }
private void SaveScene() { SavingWrapper savingWrapper = GetSavingWrapper(); savingWrapper.Save(); }
private void Start() { loadScreen = FindObjectOfType <LoadScreen>(); savingWrapper = FindObjectOfType <SavingWrapper>(); }
private void Start( ) { spawnPoint = GetComponentInChildren <Transform>( ); _saver = FindObjectOfType <SavingWrapper>( ); }