Beispiel #1
0
    protected override void OnDisable()
    {
        Script_GameEventsManager.OnLevelInitComplete -= OnEntranceAttack;
        Script_CombatEventsManager.OnEnemyAttackEnd  -= OnEntranceAttackEnd;

        playerPlayableDirector.stopped -= OnDropTimelineDone;
        playerPlayableDirector          = null;

        if (EileenThemePlayer != null)
        {
            AudioSource audio = EileenThemePlayer?.GetComponent <AudioSource>();
            audio.volume = 0f;
            audio.Pause();
        }

        if (!isTimelineControlled)
        {
            game.UnPauseBgMusic();
        }

        isTimelineControlled = false;
    }
Beispiel #2
0
    // ----------------------------------------------------------------------

    public override void Setup()
    {
        // Handle saving BGM played state.
        game.PauseBgMusic();
        AudioSource audio = EileenThemePlayer.GetComponent <AudioSource>();

        audio.volume = 1f;
        audio.gameObject.SetActive(true);
        if (!audio.isPlaying)
        {
            audio.UnPause();
        }

        // Handle coming from Eileen Mind painting
        Debug.Log($"LB21: Last LB is {game.LastLevelBehavior}");
        if (game.LastLevelBehavior == LB26)
        {
            Debug.Log("Player coming from LB26_EileensMind");
            PlayerEntranceFromEileenMind();
        }

        BaseSetup();
    }
    /* ===========================================================================================
    *   CUTSCENE
    *  =========================================================================================== */

    /// <summary>
    /// when director is finished, start the next dialogue node
    /// </summary>
    public void OnElleniaPlayableDone(PlayableDirector aDirector)
    {
        // walked to first painting
        if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[0])
        {
            Script_DialogueManager.DialogueManager.StartDialogueNode(cutSceneNodes[0], false);
        }
        // walked to middle painting
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[1])
        {
            Script_DialogueManager.DialogueManager.StartDialogueNode(cutSceneNodes[1], false);
        }
        // walked to last painting
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[2])
        {
            Script_DialogueManager.DialogueManager.StartDialogueNode(cutSceneNodes[2], false);
        }
        // walked to room center
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[3])
        {
            Script_DialogueManager.DialogueManager.StartDialogueNode(cutSceneNodes[3], false);
        }
        // return to easle
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[4])
        {
            OnReturnedToEasle();
        }
        /// OnCorrect Timeline
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[5])
        {
            Script_DialogueNode onSubmitCorrectNode = Ellenia.MyPastQuestState == Script_DemonNPC.PastQuestState.Done
                ? onCorrectDonePastQuestDoneNode
                : onCorrectDoneNode;

            // Start dialogue & fade out music.
            // If it's Weekend, use already done nodes.
            if (game.RunCycle == Script_RunsManager.Cycle.Weekend)
            {
                Script_DialogueManager.DialogueManager.StartDialogueNode(onCorrectWeekendNode, false);
            }
            else
            {
                Script_DialogueManager.DialogueManager.StartDialogueNode(onSubmitCorrectNode, false);
            }

            StartCoroutine(
                Script_AudioMixerFader.Fade(
                    audioMixer,
                    BGMParam,
                    bgMusicEndIntroFadeOutTime,
                    0f,
                    () => {
                AudioSource ElleniaAudio = ElleniaBgThemePlayer.GetComponent <AudioSource>();
                if (ElleniaAudio.isPlaying)
                {
                    ElleniaAudio.volume = 0f;
                    ElleniaAudio.Stop();
                    ElleniaAudio.gameObject.SetActive(false);
                }
                if (game.BGMManager.GetIsPlaying())
                {
                    game.PauseBgMusic();
                }
            }
                    )
                );
        }
        // Ellenia walked to the Exit and will brag to Player to look at her painting.
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[6])
        {
            Script_DialogueManager.DialogueManager.StartDialogueNode(beforeExitNode, SFXOn: true);
        }
        // Ellenia actually exits.
        else if (aDirector.playableAsset == GetComponent <Script_TimelineController>().timelines[7])
        {
            OnElleniaExitsDone();
        }

        void OnReturnedToEasle()
        {
            var VCamManager = Script_VCamManager.VCamMain;

            VCamManager.SwitchToMainVCam(followElleniaVCam);
            VCamManager.SetDefaultCinemachineBlendUpdateMethod();

            Script_DialogueManager.DialogueManager.StartDialogueNode(cutSceneNodes[4], false);
        }
    }