コード例 #1
0
    private void Update()
    {
        if (m_SceneInputs == null)
        {
            return;
        }

        foreach (var sceneInput in m_SceneInputs)
        {
            if (Input.GetKeyDown(sceneInput.m_input))
            {
                var nextScene = SceneManagerExtension.GetBuildIndexByName(sceneInput.m_sceneName);

                if (nextScene >= 0)
                {
                    EventManager.Instance.Raise(new BeforeChangeToNextStageEvent(
                                                    SceneManager.GetActiveScene().buildIndex, nextScene));

                    SceneManager.LoadSceneAsync(sceneInput.m_sceneName, LoadSceneMode.Single);
                    return;
                }
                else
                {
                    Debug.LogError("Invalid Scene Name!");
                }
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// Fade brightness to zero and then load the scene
    /// </summary>
    private IEnumerator LoadScene()
    {
        var nextScene = SceneManagerExtension.GetBuildIndexByName(m_loadSceneName);

        if (nextScene < 0)
        {
            Debug.LogError("Invalid Scene Name!");
            yield break;
        }

        PostProcessingProfile effect = Instantiate <PostProcessingProfile> (
            m_brightnessEffect.profile);

        ColorGradingModel.Settings effectSetting = effect.colorGrading.settings;

        m_brightnessEffect.profile = effect;

        // Fade brightness
        float timer = 0;

        while (timer < 2)
        {
            JITimer.Instance.TimeScale = 0;
            timer += JITimer.Instance.RealDeltTime;
            effectSetting.basic.postExposure = -5 * timer;
            effect.colorGrading.settings     = effectSetting;
            yield return(null);
        }

        EventManager.Instance.Raise(new BeforeChangeToNextStageEvent(
                                        SceneManager.GetActiveScene().buildIndex, nextScene));

        SceneManager.LoadSceneAsync(m_loadSceneName, LoadSceneMode.Single);
    }