Example #1
0
        protected AC.DialogueOption GetDialogueOption(GameObject workingNode)
        {
            AC.DialogueOption dialogueOption = workingNode.GetComponent <AC.DialogueOption>();

            if (dialogueOption == null)
            {
                workingNode.AddComponent <AC.DialogueOption>();
                dialogueOption         = workingNode.GetComponent <AC.DialogueOption>();
                dialogueOption.actions = new List <AC.Action>();
            }

            return(dialogueOption);
        }
Example #2
0
        private void AddSpeechToDialog(Speech node, AC.DialogueOption dialogueOption)
        {
            AC.ActionSpeech newSpeech = ScriptableObject.CreateInstance <AC.ActionSpeech>();

            newSpeech.isPlayer = node.PlayerLine;
            if (node.Speaker.Character != null)
            {
                newSpeech.speaker = node.Speaker.Character.GetComponent <AC.Char>();
            }
            newSpeech.messageText    = node.SpeechText;
            newSpeech.noAnimation    = node.NotAnimateSpeaker;
            newSpeech.isBackground   = node.PlayBackground;
            newSpeech.waitTimeOffset = node.Offset;

            dialogueOption.actions.Add(newSpeech);
        }
Example #3
0
        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;
                        }
                    }
                }
            }
        }
Example #4
0
        protected List <AbstractNode> RecursiveCheckChildren(Speech node, GameObject workingNode)
        {
            List <AbstractNode> returnList = new List <AbstractNode>();

            AC.DialogueOption dialogueOption = GetDialogueOption(workingNode);

            AddSpeechToDialog(node, dialogueOption);

            foreach (int childKey in node.GetActiveConnections().Keys)
            {
                AbstractNode childNode = db.GetNodeByUniqueID(node.GetActiveConnections()[childKey]);

                if (childNode.GetType() == typeof(Speech))
                {
                    returnList.AddRange(RecursiveCheckChildren((Speech)childNode, workingNode));
                }
                else if (childNode.GetType() == typeof(DialogSeed))
                {
                    returnList.Add(childNode);
                }
            }
            return(returnList);
        }