Exemple #1
0
        public void AddMessage(Text p_textObject, string p_sentence)
        {
            _textObject = p_textObject;

            SetActive(true);

            string[] words = p_sentence.Split(new string[] { " " }, System.StringSplitOptions.None);
            foreach (string word in words)
            {
                TextCharacters text_character = new TextCharacters(word);
                textArray.Add(text_character);
                textArray.Add(new TextCharacters(" "));
            }

            StartCoroutine(ShowText());
        }
Exemple #2
0
        private IEnumerator ShowText()
        {
            for (int i = 0; i < textArray.Count; i++)
            {
                TextCharacters _text = textArray[i];

                for (int k = 0; k < _text.characters.Length; k++)
                {
                    _textObject.text = _textObject.text + _text.characters[k].ToString();
                    yield return(new WaitForSeconds(_text.time_periods));
                }
            }

            yield return(new WaitForSeconds(1.5f));

            _textObject.DOFade(0, 0.5f);
        }