Ejemplo n.º 1
0
        public ConditionalDialogueNode GetNextNode()
        {
            if (indexing >= Count || indexing == 1)
            {
                ReachedEnd = true; return(null);
            }
            ConditionalDialogueNode currentNode = Nodes[indexing];

            ConditionalDialogueNode[] childrens = currentNode.GetChildren();

            for (int i = 0; i < childrens.Length && !ReachedEnd; i++)
            {
                if (childrens[i].ConditionMet)
                {
                    int nextIndex = SearchNodeIndex(childrens[i].NodeID);

                    indexing = nextIndex;
                }
            }

            if (currentNode.Value == ConditionalDialogueNode.StartValue)
            {
                return(GetNextNode());
            }
            return(currentNode);
        }
Ejemplo n.º 2
0
 public void AddChildToStart(ConditionalDialogueNode child)
 {
     if (child.NodeID == null || child.NodeID.Trim() == "")
     {
         child.NodeID = AutoID();
     }
     Nodes.Add(child);
     Nodes[0].Add(child);
 }
Ejemplo n.º 3
0
 public void AddChildToStart(ConditionalDialogueNode child, string child_id)
 {
     if (child.ParentNode == null)
     {
         child.ParentNode = Nodes[0];
     }
     child.NodeID = child_id;
     Nodes.Add(child);
     Nodes[0].Add(child);
 }
Ejemplo n.º 4
0
        public void AddChild(ConditionalDialogueNode parent, ConditionalDialogueNode child, INodeOwner owner)
        {
            if (Nodes.Count == 2)
            {
                if (child.ParentNode == null)
                {
                    child.ParentNode = Nodes[0];
                }
                if (child.NodeID == null || child.NodeID.Trim() == "")
                {
                    child.NodeID = AutoID();
                }
                child.SetNodeOwner(owner);
                Nodes.Add(child);
                Nodes[0].Add(child);
            }
            else
            {
                int index = SearchNodeIndexByValue(parent.Value);
                if (index == -1)
                {
                    throw new Exception("No such parent node!");
                }
                if (child.ParentNode != null)
                {
                    //Multiple Parents
                    child.MultipleParents = true;
                    child.SetNodeOwner(owner);

                    child.AddParent(parent);
                    if (child.NodeID == null || child.NodeID.Trim() == "")
                    {
                        child.NodeID = AutoID();
                    }
                    Nodes[index].Add(child);
                }
                else
                {
                    if (child.NodeID == null || child.NodeID.Trim() == "")
                    {
                        child.NodeID = AutoID();
                    }
                    child.SetNodeOwner(owner);

                    child.AddParent(parent);
                    Nodes.Add(child);
                    Nodes[index].Add(child);
                    //SingleParent
                }
            }
        }
Ejemplo n.º 5
0
        public bool DeleteNode(ConditionalDialogueNode node)
        {
            int index = SearchNodeIndexByValue(node.Value);

            if (index == -1)
            {
                return(false);
            }
            if (Nodes[index].HasChild)
            {
                throw new Exception("This dialogue has children!");
            }
            Nodes.Remove(Nodes[index]);
            return(true);
        }
Ejemplo n.º 6
0
 public void AddParent(ConditionalDialogueNode parent)
 {
     if (MultipleParents)
     {
         if (ParentCount > 0)
         {
             if (ParentNodes[0].NodeID != parent.NodeID)
             {
                 ParentNodes.Add(parent);
             }
         }
     }
     else
     {
         ParentNode = parent;
         ParentNodes.Add(ParentNode);
     }
 }
Ejemplo n.º 7
0
 public void AddChild(ConditionalDialogueNode parent, ConditionalDialogueNode child, string child_id)
 {
     if (Nodes.Count == 2)
     {
         if (child.ParentNode == null)
         {
             child.ParentNode = Nodes[0];
         }
         child.NodeID = child_id;
         Nodes.Add(child);
         Nodes[0].Add(child);
     }
     else
     {
         int index = SearchNodeIndexByValue(parent.Value);
         if (index == -1)
         {
             throw new Exception("No such parent node!");
         }
         if (child.ParentNode != null)
         {
             //Multiple Parents
             child.MultipleParents = true;
             child.AddParent(parent);
             child.NodeID = child_id;
             Nodes[index].Add(child);
         }
         else
         {
             child.NodeID = child_id;
             child.AddParent(parent);
             Nodes.Add(child);
             Nodes[index].Add(child);
             //SingleParent
         }
     }
 }
Ejemplo n.º 8
0
 public void Add(ConditionalDialogueNode node)
 {
     ChildrenNodes.Add(node);
 }
Ejemplo n.º 9
0
 public bool NotStartOrNotEnd(ConditionalDialogueNode node) => node.Value != ConditionalDialogueNode.EndValue && node.Value != ConditionalDialogueNode.StartValue;
Ejemplo n.º 10
0
 public ConditionalDialogueNode[] GetChildren(ConditionalDialogueNode node)
 {
     return(node.GetChildren());
 }
Ejemplo n.º 11
0
        public void AddEnding(ConditionalDialogueNode parent)
        {
            int index = SearchNodeIndex(parent.NodeID);

            Nodes[index].Add(Nodes[1]);
        }