Example #1
0
    public void InputChoice(int Id)
    {
        /// Use NextNodeAction() on "yes" node to handle PaintingEntrance
        EndPrompt();

        if (Id == 0)
        {
            Script_DialogueNode currentNode = Script_DialogueManager.DialogueManager.currentNode;
            Script_DialogueNode_PaintingEntrance paintingNode = (Script_DialogueNode_PaintingEntrance)currentNode;

            paintingNode.paintingEntrance.HandleExit();

            Script_DialogueManager.DialogueManager.HandleEndDialogue();
        }
        else
        {
            Script_DialogueManager.DialogueManager.NextDialogueNode(Id);
        }
    }
    public void OnNotify(Playable origin, INotification notification, object context)
    {
        Script_DialogueStartMarker dm = notification as Script_DialogueStartMarker;

        if (dm != null)
        {
            double time = origin.IsValid() ? origin.GetTime() : 0.0;
            Debug.LogFormat("Received dialogue start notification of type {0} at time {1}", dm.GetType(), time);

            Script_DialogueNode node = nodes[dm.dialogueNodeIndex];
            bool isSFXOn             = !dm.isSilent;

            Script_DialogueManager dialogueManager = Script_DialogueManager.DialogueManager;
            dialogueManager.StartDialogueNode(node, isSFXOn);

            if (dm.isPauseTimeline)
            {
                director = (origin.GetGraph().GetResolver() as PlayableDirector);
                director.Pause();
            }
        }
    }
Example #3
0
    public void StartChoiceMode(Script_DialogueNode node)
    {
        if (node.data.locationType == "top")
        {
            activeCanvas  = choiceCanvasTop;
            activeChoices = choicesTop;
        }
        else
        {
            activeCanvas  = choiceCanvasBottom;
            activeChoices = choicesBottom;
        }

        // to get rid of flash at beginning and hide choice buttons
        foreach (Script_DialogueChoice choice in activeChoices)
        {
            choice.cursor.enabled = false;
            choice.gameObject.SetActive(false);
        }

        for (int i = 0; i < node.data.children.Length; i++)
        {
            activeChoices[i].Id = i;
            TextMeshProUGUI text = Script_Utils.FindComponentInChildWithTag <TextMeshProUGUI>(
                activeChoices[i].gameObject,
                Const_Tags.DialogueChoice
                );
            string unformattedText = node.data.children[i].data.choiceText;
            text.text = Script_Utils.FormatString(unformattedText);

            // show choice buttons with data
            activeChoices[i].gameObject.SetActive(true);
        }

        activeCanvas.gameObject.SetActive(true);
    }
    /* ===========================================================================================
    *   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);
        }
    }