public override void InstallNode(GameObject workingNode) { AC.Conversation conversation = workingNode.GetComponent <AC.Conversation>(); if (conversation.options == null) { conversation.options = new List <AC.ButtonDialog>(); } int[] keyList = new int[1] { conversation.options.Count }; AC.ButtonDialog newButtonDialog = new AC.ButtonDialog(keyList); newButtonDialog.label = DialogText; newButtonDialog.isOn = true; // By default all conversation options will stop newButtonDialog.conversationAction = AC.ConversationAction.Stop; conversation.options.Add(newButtonDialog); // We get the parent node (conversation seed node) and then add to the // ordered option unique ids this uniqueID. String parentNodeUniqueID = workingNode.name; DialogSeed parentSeed = (DialogSeed)db.GetNodeByUniqueID(parentNodeUniqueID); // Adds the node unique id to be able to work with them in the next step. parentSeed.OrderedOptionUniqueIDs.Add(UniqueID); }
public override void MakeConnections(GameObject workingNode) { AC.Conversation conversation = workingNode.GetComponent <AC.Conversation>(); Transform parentTransform = workingNode.transform.parent; foreach (string childUniqueID in ChildNodes) { // We get each child node. Only can be right now a DialogOption type. AbstractNode dialogOptionNode = db.GetNodeByUniqueID(childUniqueID); List <AbstractNode> dialogChilds = ConnectNodeChilds(dialogOptionNode); int dialogIndex = OrderedOptionUniqueIDs.FindIndex(a => a == dialogOptionNode.UniqueID); AC.ButtonDialog dialogButton = conversation.options[dialogIndex]; foreach (AbstractNode childNode in dialogChilds) { GameObject childObject = parentTransform.FindChild(childNode.UniqueID).gameObject; if (childNode.GetType() == typeof(Speech)) { AC.DialogueOption dialogueOption = childObject.GetComponent <AC.DialogueOption>(); dialogButton.dialogueOption = dialogueOption; } if (childNode.GetType() == typeof(DialogSeed)) { if (childNode.UniqueID == UniqueID) { dialogButton.conversationAction = AC.ConversationAction.ReturnToConversation; } else { AC.Conversation nextConversation = childObject.GetComponent <AC.Conversation>(); dialogButton.conversationAction = AC.ConversationAction.RunOtherConversation; dialogButton.newConversation = nextConversation; } } } } }