public void RemoveNode(DialogueGraphNode node)
        {
            int index = nodes.IndexOf(node);

            nodes.Remove(node);

            for (int i = 0; i < transitions.Count; i++)
            {
                DialogueGraphTransition transition = transitions[i];
                if (transition.from == index || transition.to == index)
                {
                    transitions.Remove(transition);
                    i--;
                }

                if (transition.from > index)
                {
                    transition.from--;
                }
                else if (transition.to > index)
                {
                    transition.to--;
                }
            }

            GUI.changed = true;
        }
예제 #2
0
        private IEnumerator ShowDialogue(int node)
        {
            currentNode = node;
            DialogueGraphNode graphNode = currentGraph.nodes[node];
            string            dialogue  = graphNode.body;

            foreach (GameObject go in buttonPool)
            {
                go.SetActive(false);
            }
            buttonPoolIndex = 0;

            int index = 0;

            while (index <= dialogue.Length)
            {
                dialogueText.text = dialogue.Substring(0, index++);
                yield return(letterCooldown);
            }

            // Apply quest notes for this dialogue node after it finishes reading
            foreach (QuestNote note in graphNode.questNotes)
            {
                GameManager.QuestSystem.AddNote(note);
            }

            DialogueGraphTransition[] transitions = GetTransitionsFor(currentGraph, node);
            foreach (DialogueGraphTransition t in transitions)
            {
                DialogueGraphNode to = t.to < 0 ? currentGraph.exitNode : currentGraph.nodes[t.to];
                CreateButton(to.name);
                yield return(letterCooldown);
            }
        }