コード例 #1
0
    private IEnumerator BuildText()
    {
        //im.HideButton();
        writing = true;
        int i = 0;

        while (i < text.Length & writing)
        {
            textComponent.text = textComponent.text + text[i];
            yield return(new WaitForSeconds(timeLapse));

            i++;
        }
        if (!writing)   // si es cancela a mitja operació, escriu el que falta
        {
            while (i < text.Length)
            {
                textComponent.text = string.Concat(textComponent.text, text[i]);
                i++;
            }
        }
        im.ShowButton();   // mostra les opcions un cop acaba d'escriure
        writing = false;
    }