Пример #1
0
    /// <summary>
    /// Método que oculta panel de texto.
    /// </summary>
    public void OcultarTexto()
    {
        ExibirTexto?.Invoke();

        _panelTexto.text = "";

        _exibirTexto = null;
    }
Пример #2
0
    private IEnumerator _mostrarTexto(string texto)
    {
        _panelTexto.text = "";

        ExibirTexto?.Invoke();

        float tempoElapsed = 0;

        Queue <char> textoCompleto = new Queue <char>();

        foreach (char letra in texto)
        {
            textoCompleto.Enqueue(letra);
        }

        yield return(new WaitForSeconds(FindObjectOfType <GameManager>().Data.TransicaoTexto));

        while (textoCompleto.Count > 0)
        {
            tempoElapsed += Time.deltaTime;

            if (tempoElapsed > FindObjectOfType <GameManager>().Data.TempoDeExibicaoDeTexto)
            {
                _panelTexto.text += textoCompleto.Dequeue();

                tempoElapsed = 0;
            }

            yield return(null);
        }

        yield return(new WaitForSeconds(0.8f));

        ExibirTexto?.Invoke();
        _exibirTexto = null;
    }