public void CompleteReveal() { if (_animationRoutine != null) { StopCoroutine(_animationRoutine); } // make all characters visible _textUI.maxVisibleCharacters = _textUI.textInfo.characterCount; RevealCompleted?.Invoke(); }
IEnumerator RevealRoutine(float delayBetweenCharacters) { _textUI.ForceMeshUpdate(); _textUI.alpha = 1; int totalVisibleCharacters = _textUI.textInfo.characterCount; int counter = 0; while (counter <= totalVisibleCharacters && !_isPaused) { int visibleCount = counter % (totalVisibleCharacters + 1); _textUI.maxVisibleCharacters = visibleCount; counter += 1; yield return(new WaitForSeconds(delayBetweenCharacters)); } RevealCompleted?.Invoke(); }