private IEnumerator DialogueIn() { // Based on the transition, Set the start variables. InitDialogue(); // IF we want to fade in the dialogue, // ELSE IF we want to grow the dialogue, // ELSE IF we want to instantly show the dialogue. if (isFadeDialogue) { // Fade in image. StartCoroutine(GUI_Helper.FadeImage(dialogueComponent.dialogueImage, fadeTime, 0f, dialogueComponent.GetInitialDialogueUIAlpha())); // IF we have fading text as well. if (fadeText) { // Switch to the new text. dialogueComponent.SwitchText(dialogue[dialogueIndex]); // Fade in text. StartCoroutine(GUI_Helper.FadeText(dialogueComponent.dialogueText, textFadeTime, 0f, dialogueComponent.GetInitialDialogueTextAlpha())); // Wait for the longer time of the dialogue fade or the dialogue fade text time. yield return(new WaitForSeconds(Mathf.Max(fadeTime, textFadeTime))); yield break; } // Wait for the length of the Dialogue Box fade. yield return(new WaitForSeconds(fadeTime)); } else if (isGrowShrinkDialogue) { // Grow the dialogue. yield return(StartCoroutine(GUI_Helper.GrowShrinkImage(dialogueComponent.dialogueImage, growShrinkTime, dialogueComponent.dialogueImage.transform.localScale.x, dialogueComponent.dialogueImage.transform.localScale.y, dialogueComponent.GetInitialDialogueScale().x, dialogueComponent.GetInitialDialogueScale().y))); } else if (isInstantDialogue) { // No Coroutines needed but leaving this here incase you want to implement something. } // Switch to the new text. dialogueComponent.SwitchText(dialogue[dialogueIndex]); // IF we want to fade the text, // ELSE IF we want the text to be typed out, // ELSE IF we want the text to be displayed instantly. if (fadeText) { // Start the fade on the text. yield return(StartCoroutine(GUI_Helper.FadeText(dialogueComponent.dialogueText, textFadeTime, 0f, dialogueComponent.GetInitialDialogueTextAlpha()))); } else if (typedText) { // Dont move forward until the typing of the text is finished. yield return(StartCoroutine(GUI_Helper.TypeText(dialogueComponent.dialogueText, dialogueTextPause, dialogue[dialogueIndex], typeSound))); } else if (instantText) { // No Coroutine needed but leaving this here incase you want to implement something. } }
private IEnumerator DialogueTextIn() { // Switch the dialogue text. dialogueComponent.SwitchText(dialogue[dialogueIndex]); // IF we want to fade the text, // ELSE IF we want the text to be typed out, // ELSE IF we want the text to appear instantly. if (fadeText) { yield return(StartCoroutine(GUI_Helper.FadeText(dialogueComponent.dialogueText, textFadeTime, 0f, dialogueComponent.GetInitialDialogueTextAlpha()))); } else if (typedText) { // Dont move forward until the typing of the text is finished. yield return(StartCoroutine(GUI_Helper.TypeText(dialogueComponent.dialogueText, dialogueTextPause, dialogue[dialogueIndex], typeSound))); } else if (instantText) { // No Coroutine needed but leaving this here incase you want to implement something. } }