Exemplo n.º 1
0
    public IEnumerator LoadLevel()
    {
        yield return(StartCoroutine(_screenFader.FadeSceneOut()));

        SceneManager.LoadSceneAsync("Game");
        yield return(StartCoroutine(_screenFader.FadeSceneIn()));
    }
Exemplo n.º 2
0
    protected IEnumerator Transition(GameObject transitioningGameObject, Vector3 destinationPosition, bool fade = false, System.Action beforTeleport = null, System.Action InTelePort = null, System.Action afterTeleport = null)
    {
        m_Transitioning = true;

        if (beforTeleport != null)
        {
            beforTeleport();
        }

        if (fade)
        {
            yield return(StartCoroutine(ScreenFader.FadeSceneOut()));
        }

        transitioningGameObject.transform.position = destinationPosition;
        if (InTelePort != null)
        {
            InTelePort();
        }

        if (fade)
        {
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));
        }

        m_Transitioning = false;

        if (afterTeleport != null)
        {
            afterTeleport();
        }
    }
Exemplo n.º 3
0
    protected IEnumerator Transition(GameObject transitioningGameObject, bool releaseControl, bool resetInputValues, Vector3 destinationPosition, bool fade, System.Action callback = null)
    {
        m_Transitioning = true;

        if (releaseControl)
        {
            //if (m_PlayerInput == null)
            //    m_PlayerInput = FindObjectOfType<PlayerInput>();
            //m_PlayerInput.ReleaseControl(resetInputValues);
        }

        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;

        if (callback != null)
        {
            callback();
        }
    }
Exemplo n.º 4
0
    protected IEnumerator Transition(GameObject transitioningGameObject, bool releaseControl, bool resetInputValues, Vector3 destinationPosition, bool fade)
    {
        m_Transitioning = true;

        if (releaseControl)
        {
            if (m_PlayerInput == null)
            {
                m_PlayerInput = FindObjectOfType <PlayerCharacter> ();
            }
            m_PlayerInput.SetReadInput(false);
        }

        if (fade)
        {
            yield return(StartCoroutine(ScreenFader.FadeSceneOut()));
        }

        transitioningGameObject.transform.position = destinationPosition;

        if (fade)
        {
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));
        }

        if (releaseControl)
        {
            m_PlayerInput.SetReadInput(true);
        }

        m_Transitioning = false;
    }
    void Awake()
    {
        if (Instance != this)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        m_PlayerInput = FindObjectOfType <PlayerInput>();

        if (initialSceneTransitionDestination != null)
        {
            SetEnteringGameObjectLocation(initialSceneTransitionDestination);
            ScreenFader.SetAlpha(1f);
            StartCoroutine(ScreenFader.FadeSceneIn());
            initialSceneTransitionDestination.OnReachDestination.Invoke();
        }
        else
        {
            m_CurrentZoneScene          = SceneManager.GetActiveScene();
            m_ZoneRestartDestinationTag = SceneTransitionDestination.DestinationTag.A;
        }
    }
    private IEnumerator DieRespawnCoroutine(bool resetHealth)
    {
        if (m_LastCheckpoint != null)
        {
            if (m_LastCheckpoint.forceResetGame)
            {
                yield return(StartCoroutine(ScreenFader.FadeSceneOut(ScreenFader.FadeType.Loading)));

                if (resetHealth)
                {
                    m_Damageable.SetHealth(m_Damageable.startingHealth);
                }
                else
                {
                    Debug.Log(m_LastCheckpoint.GetHealth());
                    m_Damageable.SetHealth(m_LastCheckpoint.GetHealth());
                }


                SceneController.RestartZoneAtPosition(new Vector3(m_LastCheckpoint.transform.position.x, m_LastCheckpoint.transform.position.y, transform.position.z));
            }
            else
            {
                yield return(new WaitForSeconds(0.2f)); //wait one second before respawing

                yield return(StartCoroutine(ScreenFader.FadeSceneOut()));

                Respawn(resetHealth);
                yield return(new WaitForSeconds(0.3f));

                yield return(StartCoroutine(ScreenFader.FadeSceneIn()));
            }
        }
    }
    protected IEnumerator Transition(string newSceneName, bool resetInputValues, SceneTransitionDestination.DestinationTag destinationTag, TransitionPoint.TransitionType transitionType = TransitionPoint.TransitionType.DifferentZone)
    {
        m_Transitioning = true;
        PersistentDataManager.SaveAllData();

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

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

        m_PlayerInput = FindObjectOfType <PlayerInput>();
        m_PlayerInput.ReleaseControl(resetInputValues);
        PersistentDataManager.LoadAllData();
        SceneTransitionDestination entrance = GetDestination(destinationTag);

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

        m_PlayerInput.GainControl();

        m_Transitioning = false;
    }
Exemplo n.º 8
0
    //By Scene index
    protected IEnumerator Transition(int newSceneIndex)
    {
        m_Transitioning = true;

        yield return(StartCoroutine(ScreenFader.FadeSceneOut(ScreenFader.FadeType.Loading)));

        yield return(SceneManager.LoadSceneAsync(newSceneIndex));

        yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

        LevelManager.Instance.enabled = true;
        m_Transitioning = false;
    }
Exemplo n.º 9
0
    protected IEnumerator Transition(string newSceneName)
    {
        mTransitioning = true;

        yield return(StartCoroutine(ScreenFader.FadeSceneOut(ScreenFader.FadeType.Loading)));

        yield return(SceneManager.LoadSceneAsync(newSceneName));

        // SetupNewScene(transitionType, entrance);
        yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

        mTransitioning = false;
    }
Exemplo n.º 10
0
    // fadeduration * 2 < invulnerabilityDuration
    IEnumerator DieRespawnCoroutine()
    {
        Publisher.Instance.GainOrReleaseControl(false);
        yield return(new WaitForSeconds(1.0f));

        yield return(StartCoroutine(ScreenFader.FadeSceneOut()));

        Respawn();
        yield return(new WaitForEndOfFrame());

        yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

        Publisher.Instance.GainOrReleaseControl(true);
    }
Exemplo n.º 11
0
    private IEnumerator Transition(GameObject transitioningGameObject, Vector3 destinationPosition, bool fade)
    {
        m_IsTransitioning = true;

        if (fade)
        {
            yield return(StartCoroutine(ScreenFader.FadeSceneOut()));
        }

        transitioningGameObject.transform.position = destinationPosition;

        if (fade)
        {
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));
        }

        m_IsTransitioning = false;
    }
Exemplo n.º 12
0
    IEnumerator DieRespawnCoroutine(bool resetHealth, bool useCheckPoint)
    {
        PlayerInput.Instance.ReleaseControl(true);
        yield return(new WaitForSeconds(1.0f));

        yield return(StartCoroutine(ScreenFader.FadeSceneOut(useCheckPoint ? ScreenFader.FadeType.Black : ScreenFader.FadeType.GameOver)));

        if (!useCheckPoint)
        {
            yield return(new WaitForSeconds(2.0f));
        }
        Respawn(resetHealth, useCheckPoint);
        yield return(new WaitForEndOfFrame());

        yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

        PlayerInput.Instance.GainControl();
    }
Exemplo n.º 13
0
        protected IEnumerator RespawnRoutine()
        {
            // Wait for the animator to be transitioning from the EllenDeath state.
            //while (m_CurrentStateInfo.shortNameHash != m_HashEllenDeath || !m_IsAnimatorTransitioning) {
            //     yield return null;
            // }

            // Wait for the screen to fade out.
            yield return(StartCoroutine(ScreenFader.FadeSceneOut()));

            while (ScreenFader.IsFading)
            {
                yield return(null);
            }

            // Enable spawning.
            //todo EllenSpawn spawn = GetComponentInChildren<EllenSpawn>();
            //spawn.enabled = true;

            // If there is a checkpoint, move Ellen to it.
            if (m_CurrentCheckpoint != null)
            {
                transform.position = m_CurrentCheckpoint.transform.position;
                transform.rotation = m_CurrentCheckpoint.transform.rotation;
            }
            else
            {
                Debug.LogError("There is no Checkpoint set, there should always be a checkpoint set. Did you add a checkpoint at the spawn?");
            }

            // Get Ellen's health back.
            m_Damageable.ResetDamage();
            m_PawnStats.ResetPlayerStats();

            // Set the Respawn parameter of the animator.
            m_Animator.SetTrigger(m_HashRespawn);

            // Start the respawn graphic effects.
            // todo spawn.StartEffect();

            // Wait for the screen to fade in.
            // Currently it is not important to yield here but should some changes occur that require waiting until a respawn has finished this will be required.
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));
        }
Exemplo n.º 14
0
    IEnumerator DieRespawnCoroutine(bool resetHealth, bool useCheckPoint, float waitTime) // Release user control. Fade out. Respawn. Fade in. Regain control. Currently set up to respawn player on a "gameover" death. Can be set up to pause of gameover canvas and offer choices.
    {
        PlayerInput.Instance.ReleaseControl(true);
        yield return(new WaitForSeconds(waitTime));

        yield return(StartCoroutine(ScreenFader.FadeSceneOut(useCheckPoint ? ScreenFader.FadeType.Black : ScreenFader.FadeType.GameOver)));

        if (!useCheckPoint)
        {
            yield return(new WaitForSeconds(2.0f));
        }

        Respawn(resetHealth, useCheckPoint); // Triggers actual respawn.

        yield return(new WaitForEndOfFrame());

        yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

        PlayerInput.Instance.GainControl();
    }
Exemplo n.º 15
0
    IEnumerator Write(bool fade, int textIndex)
    {
        m_IsTurning = true;

        if (m_ImageChange && fade)
        {
            yield return(ScreenFader.FadeSceneOut(ScreenFader.FadeType.Black));

            // 현재 클립이미지 저장
            cutSceneImage.sprite = clipTable.clips[m_CurrentClip];
            writeText.text       = "";
            m_ImageChange        = false;

            yield return(ScreenFader.FadeSceneIn());
        }

        //Output Text를 클리어하고 Text의 길이를 저장한다.
        writeText.text   = "";
        m_CharacterCount = clipTable.readTexts[textIndex].text.Length;

        if (m_CharacterCount == 0)
        {
            m_CharacterCount = clipTable.readTexts[textIndex].text.Length;
        }

        //딜레이 카운트
        for (int i = 0; i < m_DelayTextCount; i++)
        {
            writeText.text += clipTable.readTexts[textIndex].text.Substring(i, 1);
            yield return(new WaitForSeconds(writeDelay));
        }

        m_IsTurning = false;

        //텍스트 개수만큼 반복해서 지연시켜가며 한글자씩 출력한다.
        for (int i = m_DelayTextCount; i < m_CharacterCount; i++)
        {
            writeText.text += clipTable.readTexts[textIndex].text.Substring(i, 1);
            yield return(new WaitForSeconds(writeDelay));
        }
    }
Exemplo n.º 16
0
    private IEnumerator InTransition(bool fade, bool cameraSetting, CellTransitionDestination entrance, bool resetParallax = false)
    {
        m_Transitioning = true;
        Publisher.Instance.GainOrReleaseControl(false);

        if (fade)
        {
            yield return(ScreenFader.FadeSceneOut());
        }

        Publisher.Instance.SetAnimState(true, false);
        Publisher.Instance.SetObservers(true, true, entrance.locations);
        cellController.CurrentCell.ResetCell(false);

        if (cameraSetting)
        {
            cellController.SetCell(rootCell, initalCellTransitionDestinationTag);
            if (cellController.PreviousCell != rootCell)
            {
                cellController.DisablePreviousCell();
            }
            screenManager.autoCameraSetup.SetMainConfinerBound(rootCell.confinerCollider);
        }

        if (resetParallax)
        {
            parallaxScroller.Initialize();
        }

        UIManager.Instance.TimerUI.ResetTimer();

        if (fade)
        {
            yield return(ScreenFader.FadeSceneIn());
        }

        Publisher.Instance.GainOrReleaseControl(true);
        UIManager.Instance.TimerUI.StartTimer();
        m_Transitioning = false;
    }
Exemplo n.º 17
0
    private IEnumerator Transition(string newSceneName, CellTransitionDestination.DestinationTag destinationTag, TransitionPoint.TransitionType transitionType = TransitionPoint.TransitionType.DifferentZone)
    {
        m_Transitioning = true;

        yield return(StartCoroutine(ScreenFader.FadeSceneOut(ScreenFader.FadeType.Black)));

        yield return(SceneManager.LoadSceneAsync(newSceneName));

        cellController   = FindObjectOfType <CellController>();
        screenManager    = FindObjectOfType <ScreenManager>();
        parallaxScroller = FindObjectOfType <ParallaxScroller>();
        var publisher = FindObjectOfType <Publisher>();

        publisher.GainOrReleaseControl(false);
        cellController.GetRootCell(out rootCell);
        cellController.SetCell(rootCell, destinationTag);
        publisher.SetObservers(false, true, cellController.LastEnteringDestination.locations);
        screenManager.autoCameraSetup.SetMainConfinerBound(rootCell.confinerCollider);

        yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

        publisher.GainOrReleaseControl(true);
        m_Transitioning = false;
    }
Exemplo n.º 18
0
    IEnumerator ShowPressToStart()
    {
        yield return(_screenFader.FadeSceneIn());

        isShowing = true;
    }