Beispiel #1
0
        /// <summary>
        /// Renders the current game frame e.g. animate the text coming in
        /// </summary>
        /// <param name="frame">the frame to render</param>
        /// <returns>Co-routine to run</returns>
        private IEnumerator RenderFrame(DialogFrame frame)
        {
            IsTypingText = true;
            GameFrameDialogueText.text = "";

            // Show a new character on each frame
            foreach (var c in frame.Text)
            {
                if (GameFrameDialogueText.text.Length > 10)
                {
                    IsFrameSkippable = true;
                }

                GameFrameDialogueText.text += c;
                yield return(null);
            }

            IsTypingText     = false;
            IsFrameSkippable = true;

            // Move to new scene upon finish
            if (frame.TransitionFrame)
            {
                // Add a slight delay before transitioning
                yield return(new WaitForSeconds(0.25f));

                OnCompleteFrame();
                CloseDialog();
                Toolbox.Instance.GameManager.ChangeScene(frame.TransitionToScene);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Shows the given <paramref name="frame"/>
        /// </summary>
        /// <param name="frame">the frame to show</param>
        private void ShowFrame(DialogFrame frame)
        {
            // Setup user interface
            CurrentDialogFrame = frame;
            SetupGameFrame();
            SetupAvatar();

            // Animate the next frame
            StopCoroutine("RenderFrame");
            StartCoroutine("RenderFrame", frame);
        }
Beispiel #3
0
 public Dialog(DialogFrame startFrame, Dictionary <string, DialogPosition> directions, Runnable onComplete = null)
 {
     StartFrame = startFrame;
     Directions = directions;
     OnComplete = onComplete;
 }