private IEnumerator LoadWithFader(int sceneNumber) { //DontDestroyOnLoad(gameObject); wrapper.Save(); yield return(fader.FadeOut(fadeOutTime)); yield return(SceneManager.LoadSceneAsync(sceneNumber)); wrapper.Load(); yield return(new WaitForSeconds(waitTime)); yield return(fader.FadeIn(fadeInTime)); //Destroy(gameObject); }
private IEnumerator Transition() { if (sceneToLoad < 0) { Debug.LogError("Scene to load not set."); yield break; } 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); }
IEnumerator EndDialogue() { TextObject.SetActive(false); DontDestroyOnLoad(gameObject); Fader fader = FindObjectOfType <Fader>(); SavingWrapper savingWrapper = FindObjectOfType <SavingWrapper>(); // Fade Out yield return(fader.FadeOut(2)); savingWrapper.Save(); yield return(SceneManager.LoadSceneAsync(1)); savingWrapper.Load(); savingWrapper.Save(); yield return(new WaitForSeconds(1)); yield return(fader.FadeIn(2)); Destroy(gameObject); }
private void LoadGame() { savingWrapper.Load(); if (levelList == null) { CreateList(); } }
private void Awake() { Debug.Log("--- Overworld : Enter ---"); _canvasUI.SetActive(true); // dev: enable the canvas if it was disabled during editing Time.timeScale = 1; _savingWrapper.Load(); // load the game state UpdateGameProgress(); // update the game state Save(); // save the game state }
private IEnumerator Transition() { if (_sceneToLoad < 0) { Debug.Log("Scene to load not set"); yield break; } DontDestroyOnLoad(gameObject); Fader fader = FindObjectOfType <Fader>(); SavingWrapper wrapper = FindObjectOfType <SavingWrapper>(); PlayerController playerController = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); playerController.enabled = false; yield return(fader.FadeOut(fadeOutTime)); // Save Level wrapper.Save(); yield return(SceneManager.LoadSceneAsync(_sceneToLoad)); PlayerController newPlayerController = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); newPlayerController.enabled = false; Portal otherPortal = GetOtherPortal(); // Load Level wrapper.Load(); UpdatePlayer(otherPortal); // Save Again with the new position wrapper.Save(); yield return(new WaitForSeconds(fadeWaitTime)); fader.FadeIn(fadeInTime); newPlayerController.enabled = true; Destroy(gameObject); }
private IEnumerator DieEffect() { yield return(_fader.FadeOut(1f)); _savingWrapper.Load(); yield return(new WaitForSeconds(1f)); //_ragdollPlayerController.DisableRagdollEffect(); RestoreMaxHealth(); _mana.RestoreMaxMana(); _isDead = false; _animator.SetBool(_isDeadHash, _isDead); _ragdollPlayerController.SwitchCustomComponents(); yield return(new WaitForSeconds(1f)); yield return(_fader.FadeIn(1f)); }
IEnumerator Transition() { DontDestroyOnLoad(gameObject); Fader fader = FindObjectOfType <Fader>(); SavingWrapper savingWrapper = FindObjectOfType <SavingWrapper>(); //remove player's control to escape of race condition Player playerMovement = GameObject.FindWithTag("Player").GetComponent <Player>(); playerMovement.enabled = false; yield return(fader.FadeOut(fadeOutTime)); savingWrapper.Save(); yield return(SceneManager.LoadSceneAsync(nextScene)); //remove player's control in a new scene Player newPlayerMovement = GameObject.FindWithTag("Player").GetComponent <Player>(); newPlayerMovement.enabled = false; savingWrapper.Load(); Portal otherPortal = GetOtherPortal(); PlayerUpdate(otherPortal); savingWrapper.Save(); yield return(new WaitForSeconds(fadeWaitTime)); fader.FadeIn(fadeInTime); //return control newPlayerMovement.enabled = true; Destroy(gameObject); }
private IEnumerator Transition() { if (sceneToLoad < 0) { Debug.LogError("Scene to load is not set"); yield break; } DontDestroyOnLoad(gameObject); // Nonsense - was adding more objects to scene Fader fader = FindObjectOfType <Fader>(); SavingWrapper savingWrapper = FindObjectOfType <SavingWrapper>(); yield return(fader.FadeOut(fadeOutTime)); savingWrapper.Save(); yield return(SceneManager.LoadSceneAsync(sceneToLoad)); savingWrapper.Load(); print("Scene loaded"); Portal otherPortal = GetOtherPortal(); print("Portal other portal"); UpdatePlayer(otherPortal); print("Player updated"); yield return(new WaitForSeconds(fadeWaitTime)); yield return(fader.FadeIn(fadeInTime)); yield return(new WaitForSeconds(fadeWaitTime)); Destroy(gameObject); }
public void Load() { savingWrapper.Load(); }
public void Respawn() { _savingWrapper.Load(); ResumeGame(); }