Exemplo n.º 1
0
        /// <summary>
        /// Updates the dialogue.
        /// </summary>
        /// <param name="gameTime"></param>
        public bool Update(GameTime gameTime)
        {
            if (timer2 < INTERVAL)
            {
                timer2 += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            }
            else
            {
                timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;

                if (timer3 > INTERVAL)
                {
                    return(false);
                }

                if (timer >= currentText.Timer)
                {
                    timer = 0f;

                    if (texts.Count == 0)
                    {
                        isPlaying   = false;
                        currentText = new TextD("", 0f, false);
                        timer3     += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                    }
                    else
                    {
                        currentText = texts.Dequeue();
                    }
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the <c>Dialogue</c>.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <param name="font"></param>
 public Dialogue(Texture2D left, Texture2D right, SpriteFont font)
 {
     this.font   = font;
     timer       = timer2 = timer3 = 0f;
     this.left   = left;
     this.right  = right;
     isPlaying   = false;
     currentText = new TextD("", 0f, true);
     texts       = new Queue <TextD>();
     isPlaying   = true;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Enqueues a line of text for the dialogue.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="left"></param>
        /// <param name="timer"></param>
        public void AddText(string text, float timer, bool left)
        {
            TextD td = new TextD(text, timer, left);

            texts.Enqueue(td);
        }