private void SpawnBubbleOn(string dialogText, Transform target, float readTime, string title = "")
    {
        BubbleDialog b = bubblePool.SpawnTargetObject(bubbleObj, 3).GetComponent <BubbleDialog>();

        b.transform.position = target.transform.position + new Vector3(0, bubbleOffsetY, 0);
        b.InitBubble(dialogText, readTime, title);
    }
Exemple #2
0
    private BubbleDialog SpawnBubbleOn(string dialogText, Transform target, float readTime)
    {
        BubbleDialog b = bubblePool.SpawnTargetObject(bubbleObj, 3).GetComponent <BubbleDialog>();

        b.transform.position = target.transform.position + new Vector3(0, bubbleOffsetY, 0);
        b.InitBubble(dialogText, readTime);
        currentBubble = b;
        return(b);
    }
    private void ProgressDialog()
    {
        if (currentDialogIndex >= texts.Length)
        {
            OnDialogEnd?.Invoke();
            dialogDone    = true;
            dialogBegan   = false;
            currentBubble = null;
            return;
        }

        if (texts[currentDialogIndex].isFromActor && actor != null)
        {
            SpawnBubbleOn(texts[currentDialogIndex].bubbleText, actor.transform, texts[currentDialogIndex].timeToReadLine);
        }
        else
        {
            if (conversationMembers != null && conversationMembers.Length > texts[currentDialogIndex].targetMemberIndex &&
                texts[currentDialogIndex].targetMemberIndex >= 0 && conversationMembers[texts[currentDialogIndex].targetMemberIndex])
            {
                SpawnBubbleOn(texts[currentDialogIndex].bubbleText, conversationMembers[texts[currentDialogIndex].targetMemberIndex],
                              texts[currentDialogIndex].timeToReadLine, texts[currentDialogIndex].bubbleTitle);
            }
            else
            {
                SpawnBubbleOn(texts[currentDialogIndex].bubbleText, transform, texts[currentDialogIndex].timeToReadLine, texts[currentDialogIndex].bubbleTitle);
            }
        }
        texts[currentDialogIndex].OnExecute?.Invoke();

        currentDialogIndex++;
        if (currentDialogIndex == texts.Length)
        {
            dialogTimer = texts[currentDialogIndex - 1].timeToReadLine + offsetTimer;
        }
        else
        {
            dialogTimer = texts[currentDialogIndex - 1].timeToReadLine + offsetTimer;
        }
    }