Exemple #1
0
        private IEnumerator TextSequence()
        {
            yield return(3f);

            while (textStart < text.Count)
            {
                textAlpha = 1f;
                int   charactersOnPage     = text.GetCharactersOnPage(textStart);
                float fadeTimePerCharacter = 1f / charactersOnPage;
                for (int i = textStart; i < text.Count && !(text[i] is FancyText.NewPage); i++)
                {
                    if (text[i] is FancyText.Char c)
                    {
                        while ((c.Fade += Engine.DeltaTime / fadeTimePerCharacter) < 1f)
                        {
                            yield return(null);
                        }

                        c.Fade = 1f;
                    }
                }
                yield return(2.5f);

                while (textAlpha > 0f)
                {
                    textAlpha -= 1f * Engine.DeltaTime;
                    yield return(null);
                }

                textAlpha = 0f;
                textStart = text.GetNextPageStart(textStart);
                yield return(0.5f);
            }
            textStart = int.MaxValue;
        }