Example #1
0
        public void PlayDialog()
        {
            #region initial checks
            if (_dialogBoxAnimation.isAnimating())
            {
                return;
            }

            if (_textAnimation != null && _textAnimation.isAnimating())
            {
                _textAnimation.StopAnimation();
                return;
            }
            else
            {
                _textEffectHolder.TerminateAll();
            }

            if (_currentNode is null)
            {
                _onDialogClose.Raise();
                _dialogBoxAnimation.Close(gameObject);
                return;
            }
            #endregion

            Quote quote = _currentNode.NextQuote();

            if (quote == null) // if node is finished
            {
                if (_currentNode.Choices.Count > 0)
                {
                    _dialogVisualizer.PresentChoices(_currentNode.Choices);
                }
                else if (_currentNode.NextNode != null)
                {
                    _currentNode = _currentNode.NextNode;
                    PlayDialog();
                }
                else
                {
                    _dialogBoxAnimation.Close(gameObject);
                }
                return;
            }

            _stageForActors.Next();

            _dialogVisualizer.ShowFaceIcon(quote);
            _dialogVisualizer.SetTextStyle(quote);
            _dialogVisualizer.SetText(quote);

            _onDialogPlay.Raise();

            if (_textAnimation != null)
            {
                _textAnimation.Animate(_bodyText);
            }
            _textEffectHolder.ApplyAll(_bodyText);
        }
Example #2
0
 // used for choice buttons
 public void SetNode(DialogNode nextNode)
 {
     _currentNode = nextNode;
     PlayDialog();
 }
Example #3
0
 public void StartDialog(DialogNode firstDialogNode)
 {
     _currentNode = firstDialogNode;
     _dialogBoxAnimation.Open(gameObject);
     PlayDialog();
 }