Ejemplo n.º 1
0
    private IEnumerator FadeDialogue(Dialogue dialogue, FadeInOrOut fadeInOrOut)
    {
        yield return(FadeInOrOutDialogue(this, dialogue, fadeInOrOut));

        if (fadeInOrOut == FadeInOrOut.IN)
        {
            StartCoroutine(FadePause(dialogue, FadeInOrOut.OUT));
        }
        else if (fadeInOrOut == FadeInOrOut.OUT)
        {
            isReading = false;
        }
    }
Ejemplo n.º 2
0
    private IEnumerator FadePause(Dialogue dialogue, FadeInOrOut fadeInOrOut)
    {
        yield return(new WaitForSeconds(dialogue.TimeBeforeFadingDialogue));

        StartCoroutine(FadeDialogue(dialogue, fadeInOrOut));
    }
Ejemplo n.º 3
0
    private IEnumerator FadeInOrOutDialogue(DialogueText dialogueText, Dialogue dialogue, FadeInOrOut fadeInOrOut)
    {
        float textColorFadeTime = 0;

        if (fadeInOrOut == FadeInOrOut.IN)
        {
            dialogueText.Text.text = dialogue.DialogueText;
        }
        while (textColorFadeTime <= 1 + fadeSmoothness)
        {
            if (fadeInOrOut == FadeInOrOut.IN)
            {
                dialogueText.Text.color = Color.Lerp(Color.clear, dialogueText.OriginalColor, textColorFadeTime);
                background.color        = Color.Lerp(Color.clear, originalBGColor, textColorFadeTime);
            }
            else
            {
                dialogueText.Text.color = Color.Lerp(dialogueText.OriginalColor, Color.clear, textColorFadeTime);
                background.color        = Color.Lerp(originalBGColor, Color.clear, textColorFadeTime);
            }
            textColorFadeTime += Time.deltaTime / dialogue.FadeTime;
            yield return(new WaitForSeconds(fadeSmoothness));
        }
    }