Пример #1
0
    /// <summary>
    /// Decide if the next text should be written
    /// </summary>
    private void WriteTextRestrictions()
    {
        _timer += Time.deltaTime;
        bool input = Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0);

        if (_shouldWrite && (input || _timer >= 3))
        {
            _shouldWrite = false;
            _timer       = 0;

            if (!TextSo)
            {
                return;
            }
            if (_currentText < TextSo._texts.Length)
            {
                StopCoroutine(PerCharWriter());//Disgusting, move to Async
                _text.text = string.Empty;
                StartCoroutine(PerCharWriter());
            }
            else
            {
                _shouldWrite = false;

                _text.text   = string.Empty;
                _currentText = 0;
                _timer       = 0;
                _textSo      = null;

                Signals.Get <TextEndSignal>().Dispatch();
            }
        }
    }
Пример #2
0
 private void StartText(TextSO textSo)
 {
     _animate.AnimIn();
 }
Пример #3
0
 /// <summary>
 /// The function to get called when a TextReceived event is raised
 /// </summary>
 /// <param name="textSo"></param>
 private void WriteText(TextSO textSo)
 {
     _timer  = 0;
     _textSo = textSo;
     StartCoroutine(PerCharWriter());
 }
Пример #4
0
 private void BlockRays(TextSO textSo)
 {
     _rayBlocker.SetActive(true);
 }
Пример #5
0
 private void StopMoving(TextSO textSo)
 {
     _navMeshAgent.isStopped = true;
 }