示例#1
0
    private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        if (gameJustStarted)
        {
            gameJustStarted = false;
            return;
        }

        Transition = SceneTransition.EnteringScene;
        InitScene();
        ui.OnSceneChanged(State);
        fade.StartFadeIn(false);
        sceneJustStarted = true;
        framesWaited     = 0;

        SFXPlayer.Instance.InitAudioSrcPool();

        switch (State)
        {
        case GameState.MainMenu:
        {
            //ui.mainMenu.Activate(true);
            //MusicPlayer.Instance.Play(0, true);
            break;
        }

        case GameState.Map:
        {
            if (!gameRunning)
            {
                StartNewGame();
            }

            eventManager     = FindObjectOfType <EventManager>();
            inventoryManager = FindObjectOfType <InventoryManager>();

            if (BattleStatus != BattleState.NoBattle)
            {
                HandleBattleAftermath();
            }

            currentEventTier = 1;
            MusicPlayer.Instance.Play(0, true);
            break;
        }

        case GameState.Battle:
        {
            StartBattle();
            break;
        }
        }
    }
示例#2
0
    /// <summary>
    /// Initializes fading to a color.
    /// </summary>
    private void InitFade()
    {
        Fade = FindObjectOfType <FadeToColor>();
        if (Fade != null)
        {
            Fade.Init(UIController.fadeScreen);

            if (SceneTransition == TransitionPhase.StartingScene)
            {
                Fade.StartFadeIn(true);
            }
        }
    }