public int changeEffect(int i)
        {
            i++;
            string effect = string.Empty;

            while (this.sentence[i] != '>')
            {
                effect += this.sentence[i];
                i++;
            }

            if (TextEffect.effects.ContainsKey(effect))
            {
                this.currentEffect = TextEffect.effects[effect];
            }
            else
            {
                this.currentEffect = null;
            }
            return(i);
        }
        /// <summary>
        /// Display next sentence in dialogue
        /// </summary>
        /// <returns>If there was a Sentence to be displayed or not</returns>
        public bool DisplayNextSentence()
        {
            foreach (LetterComponent letter in this.letters)
            {
                GameObject.Destroy(letter.gameObject);
            }

            this.currentSpeed  = this.Model.WaitTime;
            this.currentEffect = null;
            this.effects.Clear();
            this.speeds.Clear();
            this.letters.Clear();
            this.currentX = 0;
            this.currentY = 0;

            if (sentences.Count == 0)
            {
                EndDialogue();
                return(false);
            }

            this.Model.ImageText.sprite = sprites.Dequeue();
            this.sentence       = sentences.Dequeue();
            this.audioQueue     = voices.Dequeue();
            this.Model.WaitTime = 0f;
            string onlyWords = string.Empty;

            for (int i = 0; i < this.sentence.Length; i++)
            {
                if (this.sentence[i] == '[')
                {
                    i = this.changeSpeed(i);
                }
                else if (this.sentence[i] == '<')
                {
                    i = this.changeEffect(i);
                }
                else
                {
                    this.effects.Add(this.currentEffect);
                    if (this.sentence[i] != ' ')
                    {
                        this.speeds.Add(( float )this.currentSpeed);
                    }
                    onlyWords += this.sentence[i];
                }
            }

            string[] words               = onlyWords.Split(' ');
            int      letterSpacing       = ( int )(this.fontSize * 0.5);
            int      currentIndexEffects = 0;
            int      currentIndexSpeeds  = 0;

            foreach (string word in words)
            {
                GameObject wordObject = new GameObject(word, typeof(RectTransform));
                wordObject.transform.SetParent(this.Model.DialogueStartPoint);
                int wordSize = word.Length * letterSpacing;
                if (this.currentX + wordSize > this.boxSize)
                {
                    this.currentX  = 0;
                    this.currentY -= ( int )(this.fontSize * 0.9);
                }
                wordObject.GetComponent <RectTransform>().localPosition = new Vector3(currentX, currentY, 0);

                for (int i = 0; i < word.Length; i++)
                {
                    GameObject letterObject = new GameObject(word[i].ToString());
                    letterObject.transform.SetParent(wordObject.transform);
                    Text myText = letterObject.AddComponent <Text>();
                    myText.text      = word[i].ToString();
                    myText.alignment = TextAnchor.LowerCenter;
                    myText.fontSize  = this.fontSize;
                    myText.font      = this.Model.Font;
                    myText.material  = this.Model.Material;
                    myText.GetComponent <RectTransform>().localPosition = new Vector3(i * letterSpacing, 0, 0);
                    myText.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
                    RectTransform rt = letterObject.GetComponentInParent <RectTransform>();
                    rt.sizeDelta = new Vector2(this.fontSize, this.fontSize);
                    rt.pivot     = new Vector2(0, 1);

                    LetterComponent letterComponent = letterObject.AddComponent <LetterComponent>();

                    Letter newLetter = new Letter
                    {
                        Character = word[i],
                        Speed     = this.speeds[currentIndexSpeeds],
                        isActive  = false
                    };
                    if (this.effects[currentIndexEffects] != null)
                    {
                        newLetter.Effect = this.effects[currentIndexEffects].Build(letterObject);
                    }
                    letterComponent.Model = newLetter;
                    this.letters.Add(letterComponent);
                    currentIndexEffects++;
                    currentIndexSpeeds++;
                }
                currentX += wordSize + letterSpacing;
                currentIndexEffects++;
            }
            return(true);
        }