public static ConversationEndNode Create(BaseDialogNode parent) { ConversationEndNode created = ScriptableObject.CreateInstance <ConversationEndNode>(); created.nodeType = "ConversationEnd"; created.parents.Add(parent); parent.children.Add(created); return(created); }
public static RandomOutputNode Create(BaseDialogNode parent) { RandomOutputNode created = ScriptableObject.CreateInstance <RandomOutputNode>(); created.nodeType = "RandomOutput"; created.parents.Add(parent); parent.children.Add(created); return(created); }
public void AddChildren(BaseDialogNode dialog) { if (dialog.GetType() == typeof(ConversationStartNode)) { Debug.Log("Dialog System: Warning! Trying to add Start Node to children."); } if (!IfChildrenFull()) { children.Add(dialog); } else { Debug.Log("Dialog System: Fail, children count of the node has reach limit."); } }
public static SimpleDialogNode Create(DialogNodeEditor.SimpleDialogNode editorNode, BaseDialogNode parent) { SimpleDialogNode created = ScriptableObject.CreateInstance <SimpleDialogNode>(); created.SpeakerID = editorNode.SpeakerID; created.DialogText = editorNode.DialogText; created.parents.Add(parent); parent.children.Add(created); return(created); }
public static ConversationJumpNode Create(DialogNodeEditor.ConversationJumpNode editorNode, BaseDialogNode parent) { ConversationJumpNode created = ScriptableObject.CreateInstance <ConversationJumpNode>(); created.nodeType = "ConversationJumpNode"; created.targetConvID = editorNode.targetID; created.parents.Add(parent); parent.children.Add(created); return(created); }
public void AddNode(BaseDialogNode node) { nodes.Add(node); }
private static void Recursive(Node processing, BaseDialogNode currentRef, Conversation tree) { if (processing == null) { Debug.Log("Converter: Recursive(): Why bother ask me to process a null object? Returnning."); return; } //If skip this check, the recursion will stuck, as pretty much execute in the for(). //Will prevent going deeper at End Node if (processing.Outputs.Count == 0) { return; } for (int i = 0; i < processing.Outputs.Count; i++) { BaseDialogNode creating = null; if (processing.Outputs[i].GetNodeAcrossConnection() == null) { Debug.Log("Converter: This connect to nothing. Returning."); return; } if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == null) { Debug.Log("Converter: Warning! Recursive() receiving null translated type."); return; } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(ConversationEndNode)) { creating = ConversationEndNode.Create(currentRef); } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(SimpleDialogNode)) { creating = SimpleDialogNode.Create(((DialogNodeEditor.SimpleDialogNode)processing.Outputs[i].GetNodeAcrossConnection()), currentRef); } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(OptionsDialogNode)) { creating = OptionsDialogNode.Create(((DialogNodeEditor.OptionsDialogNode)processing.Outputs[i].GetNodeAcrossConnection()), currentRef); } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(VariableControlNode)) { creating = VariableControlNode.Create((DialogNodeEditor.VariableControlNode)processing.Outputs[i].GetNodeAcrossConnection()); } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(VariableConditionalNode)) { creating = VariableConditionalNode.Create((DialogNodeEditor.VariableConditionalNode)processing.Outputs[i].GetNodeAcrossConnection()); } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(RandomOutputNode)) { creating = RandomOutputNode.Create(currentRef); } else if (Translate(processing.Outputs[i].GetNodeAcrossConnection().GetType()) == typeof(ConversationJumpNode)) { creating = ConversationJumpNode.Create(((DialogNodeEditor.ConversationJumpNode)processing.Outputs[i].GetNodeAcrossConnection()), currentRef); } tree.AddNode(creating); Recursive(processing.Outputs[i].GetNodeAcrossConnection(), creating, tree); } }
private void Connect(BaseDialogNode parent, BaseDialogNode child) { child.parents.Add(parent); parent.children.Add(child); }
public static OptionsDialogNode Create(DialogNodeEditor.OptionsDialogNode editorNode, BaseDialogNode parent) { OptionsDialogNode created = ScriptableObject.CreateInstance <OptionsDialogNode>(); created.nodeType = "OptionsDialogNode"; created.SpeakerID = editorNode.SpeakerID; created.DialogText = editorNode.DialogText; created.optionsText = new List <string>(editorNode.GetAllOptions().ToArray()); created.parents.Add(parent); parent.children.Add(created); return(created); }