Example #1
0
    public void NextDialogue()
    {
        AudioDialogueManager.Instance.StopAllVoices();
        m_typewriterEffect.ClearText();

        if (m_dialogueBubbleQueue == null)
        {
            return;
        }

        if (m_dialogueBubbleQueue.Count == 0)
        {
            m_panel.gameObject.SetActive(false);

            if (m_callback != null)
            {
                m_callback();
            }

            m_callback = null;
            return;
        }

        DialogueInfo dialogueInfo = m_dialogueBubbleQueue.Dequeue();

        transform.position  = dialogueInfo.Position;
        m_dialogueText.text = dialogueInfo.Dialogue;
        m_typewriterEffect.ShowText(dialogueInfo.Dialogue);

        if (dialogueInfo.NPCType != NPCType.None)
        {
            AudioDialogueManager.Instance.PlayVoiceRandomLine(dialogueInfo.NPCType);
        }

        if (dialogueInfo.Callback != null)
        {
            dialogueInfo.Callback();
        }
    }