예제 #1
0
        /// <summary>
        /// Moves to the specified node.
        /// </summary>
        internal void MoveToNode(string identifier)
        {
            BaseNode node = Dialogue.GetNode(identifier);

            if (node != null)
            {
                MoveToNode(node);
            }
            else if (m_repeatCounts.Count > 0)
            {
                DialogueRepeat repeatCount = m_repeatCounts.Pop();
                RepeatNode     repeatNode  = (RepeatNode)Dialogue.GetNode(repeatCount.NodeName);
                if (repeatCount.CurrentCount++ < repeatNode.Value)
                {
                    m_repeatCounts.Push(repeatCount);
                    MoveToNode(repeatNode.Next);
                }
                else
                {
                    MoveToNode(repeatNode.NextDone);
                }
            }
            else
            {
                CurrentNode = null;
                if (OnDialogueEnded != null)
                {
                    OnDialogueEnded(this);
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Pushes and navigates a new repeat node.
 /// </summary>
 public void PushRepeatNode(RepeatNode node)
 {
     if (node.Value <= 0)
     {
         MoveToNode(node.NextDone);
     }
     else
     {
         DialogueRepeat repeatCount = new DialogueRepeat(node.NodeName);
         repeatCount.CurrentCount++;
         m_repeatCounts.Push(repeatCount);
         MoveToNode(node.Next);
     }
 }