/// <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(); } } }
private void StartText(TextSO textSo) { _animate.AnimIn(); }
/// <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()); }
private void BlockRays(TextSO textSo) { _rayBlocker.SetActive(true); }
private void StopMoving(TextSO textSo) { _navMeshAgent.isStopped = true; }