Beispiel #1
0
        /// <summary>
        /// Return the next node of the conversation, or null if there is none
        /// </summary>
        /// <param name="_brain"></param>
        /// <param name="_currentNode"></param>
        /// <param name="_contentIndex"></param>
        /// <param name="_applyImpact"></param>
        /// <returns></returns>
        public Node GoToNextNode(NarratorBrainSO _brain, Node _currentNode, int _contentIndex, bool _applyImpact = true)
        {
            for (int i = 0; i < _currentNode.contents[_contentIndex].nextNodes.Count; i++)
            {
                bool canGoNextNode = true;

                for (int j = 0; j < _currentNode.contents[_contentIndex].nextNodes[i].conditions.Count; j++)
                {
                    if (_currentNode.contents[_contentIndex].nextNodes[i].conditions[j].IsComplete(_brain.Parameters) == false)
                    {
                        canGoNextNode = false;
                    }
                }
                if (canGoNextNode)
                {
                    for (int j = 0; j < _currentNode.contents[_contentIndex].nextNodes[i].impacts.Count; j++)
                    {
                        _brain.ApplyImpact(_currentNode.contents[_contentIndex].nextNodes[i].impacts[j]);
                    }
                    return(Dialogs[_currentNode.contents[_contentIndex].nextNodes[i].index - 1]);
                }
            }

            return(null);
        }
Beispiel #2
0
        //___________METHODS__________//

        /// <summary>
        /// Create a new Content with default values
        /// </summary>
        /// <param name="brain"></param>
        public void Initialize(NarratorBrainSO brain)
        {
            texts = new List <string>();
            for (int i = 0; i < brain.Langages.Count; i++)
            {
                texts.Add("What should I say ?");
            }

            nextNodes = new List <NextNode>();
            exitBox   = new Rect();
        }
Beispiel #3
0
        /// <summary>
        /// [EDITOR ONLY] Constructor : default values
        /// </summary>
        /// <param name="id"></param>
        /// <param name="brain"></param>
        public void CreateSpeakNode(int id, NarratorBrainSO brain)
        {
            type   = Type.speak;
            charac = new Character();

            entryBox = new Rect(windowRect.x - 10.0f, windowRect.y + windowRect.height * 0.8f, 10.0f, 10.0f);

            contents = new List <Content>();
            Content content = new Content();

            content.Initialize(brain);
            contents.Add(content);
        }