Ejemplo n.º 1
0
 void Update()
 {
     if (_typeSpeed.TryReset() && _stringIndex < _textToType.Length)
     {
         char currentChar = _textToType[_stringIndex];
         _textField.text += currentChar;
         _stringIndex++;
         // if (currentChar != ' ' || currentChar!='\n')
         //     _typeSound.Play();
         // Debug.Log(currentChar == ' ');
         if (currentChar != ' ' && currentChar != '\n')
         {
             _typeSound.Play();
         }
     }
     if (_stringIndex == _textToType.Length && !_typingEnded)
     {
         OnTypingEnd?.Invoke();
         _timeBeforeHideText.Reset();
         _typingEnded = true;
     }
     if (_typingEnded && _timeBeforeHideText.TryReset())
     {
         OnTextHidden?.Invoke();
         _textField.enabled = false;
     }
 }
Ejemplo n.º 2
0
 void Update()
 {
     if (!_isBlinking)
     {
         return;
     }
     if (_blinkPeriod.TryReset() && _blinkTimes < _willBlinkTimes)
     {
         _sound.Play();
         _blinkTimes++;
     }
     if (_blinkTimes >= _willBlinkTimes)
     {
         _text.enabled = false;
         _isBlinking   = false;
         EndBlinking?.Invoke();
     }
     _text.color = _textBaseColor * Mathf.Sin(_blinkPeriod.GetNormalizedRemainingTime() * Mathf.PI);
 }
Ejemplo n.º 3
0
    void Update()
    {
        if (!blink)
        {
            return;
        }

        if (isVisible)
        {
            textMesh.enabled = true;
        }
        else
        {
            textMesh.enabled = false;
        }

        if (_blinkPeriod.TryReset())
        {
            isVisible = !isVisible;
        }
    }