public override void MoveNext() { // Do not continue if the player hasn't made a choice if (choice != 0 && choice != 1) { Debug.LogWarning("Cannot continue, no choice has been made"); return; } DialogueGraph fmGraph = (DialogueGraph)graph; if (fmGraph.GetCurrent() != this) { Debug.LogWarning("Node isn't active"); return; } NodePort exitPort = GetOutputPort(choice == 0 ? "out1" : "out2"); if (!exitPort.IsConnected) { Debug.LogWarning("Node isn't connected"); return; } DialogueNode node = (DialogueNode)exitPort.Connection.node; node.OnEnter(); }
public override void OnHeaderGUI() { GUI.color = Color.white; DialogueNode node = (DialogueNode)target; DialogueGraph graph = (DialogueGraph)node.graph; if (graph.GetCurrent() == node) { GUI.color = Color.green; } if (graph.GetEntryPoint() == node) { GUI.color = Color.blue; } string title = target.name; GUILayout.Label(title, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30)); GUI.color = Color.white; }
public override void MoveNext() { DialogueGraph fmGraph = (DialogueGraph)graph; if (fmGraph.GetCurrent() != this) { Debug.LogWarning("Node isn't active"); return; } NodePort exitPort = GetOutputPort("output"); if (!exitPort.IsConnected) { Debug.LogWarning("Node isn't connected"); return; } DialogueNode node = (DialogueNode)exitPort.Connection.node; node.OnEnter(); }
private void Start() { DialogueGraph graph = dialogueSystem.GetDialogueGraph(); graph.Initialize(); for (int i = 0; i < graph.nodes.Count - 1; i++) { DialogueNode node = graph.GetCurrent(); if (node is TextNode textNode) { Debug.Log(textNode.GetText()); } else if (node is BinaryChoiceNode bcNode) { Debug.Log("Binary choice: " + bcNode.GetChoiceText(0) + " or " + bcNode.GetChoiceText(1)); int choice = Mathf.RoundToInt(Random.Range(0, 1)); Debug.Log("Chose: " + bcNode.GetChoiceText(choice)); bcNode.SetChoice(choice); } graph.Continue(); } }