示例#1
0
 public void Initialize(PhoneDialogue inputPhoneDialogue)
 {
     phoneDialogue = inputPhoneDialogue;
     currentNode   = phoneDialogue.dialogueNodes[0];
     StartCoroutine(Transition(0, false));
     w = new WaitForSeconds(2);
 }
示例#2
0
    private IEnumerator Transition(int intent, bool changeNode)
    {
        if (transitioning)
        {
            yield break;
        }
        transitioning = true;

        if (changeNode)
        {
            currentNode = currentNode.intentNodeMappings[intent];
        }

        if (currentNode.winState || currentNode.loseState)
        {
            enabled = false;
            yield break;
        }

        yield return(new WaitForSeconds(currentNode.responseDelay));

        if (currentNode.responseList.Count > 0)
        {
            messager.SendNewMessage(currentNode.responseList[Random.Range(0, currentNode.responseList.Count)], false);
        }

        transitioning = false;

        if (currentNode.autoTransition)
        {
            StartCoroutine(Transition(0, true));
        }
    }
 public void AssignNode(PhoneDialogue.DialogueNode newNode)
 {
     node        = newNode;
     intentTexts = new List <TextMeshProUGUI>();
 }