Exemple #1
0
        public override bool Update(GameTime gameTime)
        {
            key.Update();

            if (currentLine > 0 || currentChar > 0)
            {
                if (key.pressed)
                {
                    if (currentLine < lines.Count)
                    {
                        Sounds.FastForwardTextbox.Play();
                        currentLine = lines.Count;
                    }
                    else
                    {
                        Sounds.ClickTextBox.Play();
                        return(false);
                    }
                }
            }

            if (currentLine < lines.Count)
            {
                float last = currentChar;
                currentChar += textSpeed;
                if (currentChar >= lines[currentLine].Length)
                {
                    currentChar = 0;
                    currentLine++;
                }
                else if ((int)currentChar > (int)last && lines[currentLine][(int)currentChar] != ' ')
                {
                    Sounds.textPlop.Play();
                }
            }
            return(true);
        }