/// <summary>
    /// This method ends the dialog.
    /// </summary>
    /// <remarks>After this method is called some variable used will get cleared. The event are an exception to this.</remarks>
    public void TerminateDialog()
    {
        if (!_tree)
        {
#if DEBUG
            Debug.LogError("There is no Dialog running. You cannot terminate one.");
#endif
            return;
        }

        _tree = null;
        _currentBasicDialog = null;
        HistoryQueue.Clear();
        onDialogEnd.Invoke();
    }
    /// <summary>
    /// This method sets the current dialog node being used.
    /// It also calls the method <c>CheckIfBranching</c>
    /// </summary>
    /// <param name="basicDialog">The Dialog Node to be set as current.</param>
    public void SetDialogBox(BasicDialogNode basicDialog)
    {
        if (basicDialog == null)
        {
            TerminateDialog();
            return;
        }

        //Sets the _previous variable of the dialog given.
        if (HistoryQueue.Count != 0)
        {
            basicDialog._previous = HistoryQueue.Peek();
        }


        _currentBasicDialog = basicDialog;
        HistoryQueue.Push(basicDialog);
        onDialogBoxBegin.Invoke(basicDialog);

        CheckIfBranching(basicDialog._nexts);
    }
 /// <summary>
 /// Constructor of <c>DialogTether</c> used to preset the _destination node.
 /// </summary>
 /// <param name="destination">a <c>BasicDialogNode</c> that will be the destination.</param>
 public DialogTether(BasicDialogNode destination)
 {
     _text        = "";
     _destination = destination;
 }
 /// <summary>
 /// Constructor of <c>DialogTether</c> used to preset the _text value and _destination node.
 /// </summary>
 /// <param name="text">the string to set the _text variable</param>
 /// <param name="destination">a <c>BasicDialogNode</c> that will be the destination.</param>
 public DialogTether(string text, BasicDialogNode destination)
 {
     _text        = text;
     _destination = destination;
 }
Beispiel #5
0
 public void OnDialogBoxBegin(BasicDialogNode basicDialog)
 {
     Debug.Log("Current Dialog begins.");
     mainText.text = basicDialog._text;
 }
 public OkayDialogNode(string okayMessage, BasicDialogNode okayDestination) : base()
 {
     _nexts = new[] { new DialogTether(okayMessage, okayDestination) };
 }