Ejemplo n.º 1
0
        /// <summary>
        /// Plays the given dialogue set. If another is playing, it is overwritten by this one.
        /// </summary>
        public void PlayDialogueSet(string setName, AssetsManager assetsManagerWithDialogue)
        {
            currentText           = "";
            currentSubstringIndex = 0;

            currentDialogueSet  = new DialogueSetInstance(assetsManagerWithDialogue.GetAsset <DialogueSet>(setName));
            CurrentDialogueName = setName;
            currentDialogueSet.StartNextDialogue();

            DialogueSetStarted?.Invoke();
            DialogueChanged?.Invoke(currentDialogueSet);

            this.assetsManagerWithDialogue = assetsManagerWithDialogue;

            fullText = CurrentDialogueFullText();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Continues playing the current dialogue set, if any.
        /// If the current dialogue instance is still running, completes it (does not continue.)
        /// Does nothing if no dialogue set is currently playing.
        /// </summary>
        public void ContinueDialogueSet()
        {
            if (currentDialogueSet != null)
            {
                currentText           = "";
                currentSubstringIndex = 0;

                if (currentDialogueSet.choosingBranch)
                {
                    PlayOrContinueDialogueSet(currentDialogueSet.GetDialogueBranch(currentlySelectedDialogueBranch), assetsManagerWithDialogue);
                    currentlySelectedDialogueBranch = 0;
                    return;
                }

                if (!currentFinished)
                {                       //if the current dialogue set is not finished, finish it
                    currentText           = fullText;
                    currentSubstringIndex = fullText.Length;

                    currentFinished = true;
                }
                else
                {
                    currentDialogueSet.StartNextDialogue();
                    DialogueChanged?.Invoke(currentDialogueSet);

                    fullText = CurrentDialogueFullText();

                    currentFinished = false;

                    if (currentDialogueSet.done)
                    {
                        if (currentDialogueSet.dialogueSet.information.stringsTo != null && currentDialogueSet.dialogueSet.information.stringsTo != "")
                        {
                            PlayDialogueSet(currentDialogueSet.dialogueSet.information.stringsTo, assetsManagerWithDialogue);
                        }
                        else
                        {
                            ForceStopDialogue();
                        }
                    }
                }
            }
        }