TextHelper.typeNewText C# (CSharp) Method

typeNewText() private method

private typeNewText ( ) : IEnumerator
return IEnumerator
    IEnumerator typeNewText()
    {
        for (int i = 0;i <= newText.Length;i++) {
            if (!typing) {
                break;
            }
            thisText.text = newText.Substring(0, i);
            if (thisText.text.Length != newText.Length) {
                thisText.text = thisText.text + "|";
            }

            if (thisAudio != null) {
                if (i == 0) {
                    thisAudio.volume = 0;
                } else {
                    thisAudio.volume = 1;
                }
                thisAudio.Play();
            }

            yield return new WaitForSeconds(typeTime);
        }

        typing = false;
    }