public IEnumerator MarketTransition()
    {
        if (CurrentLocation != Location.MAIN)
        {
            yield return(StartCoroutine(ResetTransition()));
        }
        CurrentLocation = Location.MARKET;
        MainCam.LerpToTransform(Market.ObjectCamera.transform.position, Market.ObjectCamera.transform.rotation.eulerAngles);
        yield return(new WaitForSeconds(MainCam.LerpTime - MainCamFade.Duration * 0.95f));

        MainCamFade.FadeOut();
        yield return(new WaitForSeconds(MainCamFade.Duration));

        MainCam.transform.position = DrawHall.DrawCamera.transform.position;
        MainCam.transform.rotation = DrawHall.DrawCamera.transform.rotation;
        MainCamFade.FadeIn();
        yield return(true);
    }
Exemplo n.º 2
0
    private IEnumerator WaitSceneToLoad(Scene sceneToWaitFor, bool fadeIn)
    {
        while (sceneToWaitFor.isLoaded == false)
        {
            yield return(null);
        }

        IsLoadingScene = false;

        if (fadeIn && fadeCameraInstance != null)
        {
            FadeCamera.FadeIn();
        }
    }
Exemplo n.º 3
0
    public void SelectCurrentLevel(int chapterIndex, int levelIndex, bool useFadeEffect = false)
    {
        currentLevel.x        = chapterIndex;
        currentLevel.y        = levelIndex;
        timeSinceLevelStarted = Time.time;

        // We know this is a bonus level, because we are the only one sending -100 as a value for the chapter index
        StartCoroutine(chapterIndex == -100 ? LoadBonusChapterArt() : LoadNextChapterArt(currentLevel));

        if (useFadeEffect)
        {
            FadeCamera.FadeIn();
        }

        SetLastPlayedLevel();
    }
Exemplo n.º 4
0
    private IEnumerator LoadGameLevelWithFade(string levelToLoad, bool setAsCurrentLevel, bool setAsActiveLevel, bool useFadeEffect = false, bool unloadOtherScenes = false)
    {
        if (useFadeEffect)
        {
            FadeCamera.FadeOut();

            while (FadeCamera.CurrentFadeLevel < 1f)
            {
                yield return(null);
            }
        }

        SceneManager.LoadScene(levelToLoad, LoadSceneMode.Additive);

        if (setAsCurrentLevel)
        {
            SelectCurrentLevel(levelToLoad);
        }

        Scene sceneToLoad = SceneManager.GetSceneByName(levelToLoad);

        if (setAsCurrentLevel)
        {
            CurrentGameScene = sceneToLoad;
        }

        while (sceneToLoad.isLoaded == false)
        {
            yield return(null);
        }

        if (setAsActiveLevel)
        {
            SceneManager.SetActiveScene(sceneToLoad);
        }

        if (unloadOtherScenes)
        {
            for (int i = 0; i < SceneManager.sceneCount; i++)
            {
                Scene sceneToUnload = SceneManager.GetSceneAt(i);

                if (sceneToUnload.buildIndex == sceneToLoad.buildIndex)
                {
                    continue;
                }

                SceneManager.UnloadSceneAsync(sceneToUnload);
            }
        }

        yield return(null);

        if (useFadeEffect)
        {
            FadeCamera.FadeIn();

            while (FadeCamera.CurrentFadeLevel > 0f)
            {
                yield return(null);
            }
        }

        IsLoadingScene = false;
    }