Example #1
0
        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.
            }
        }
        /// <summary>
        /// Fade from one scene to another.
        /// </summary>
        public IEnumerator FadeCycle(string newScene, int sceneSpawnLocation)
        {
            // Fade out.
            yield return(StartCoroutine(GUI_Helper.FadeImage(fadeGameObject, fadeTime / 2f, 0f, 1f)));

            // Change the scene.
            Grid_Helper.helper.ChangeScene(newScene, sceneSpawnLocation);
            // Fade back in.
            yield return(StartCoroutine(GUI_Helper.FadeImage(fadeGameObject, fadeTime / 2f, 1f, 0f)));
        }
 void Awake()
 {
     // Set the transform.
     _transform = gameObject.transform;
     // Grab the main Camera Component.
     _camera = Camera.main;
     // Set the UI offsets.
     topUILength   = GUI_Helper.GetUILength(topUITag, false) / 100;
     botUILength   = GUI_Helper.GetUILength(bottomUITag, false) / 100f;
     leftUILength  = GUI_Helper.GetUILength(leftUITag, true) / 100f;
     rightUILength = GUI_Helper.GetUILength(rightUITag, true) / 100f;
 }
Example #4
0
        private IEnumerator DisplayDialogue()
        {
            // IF we have typed text.
            if (typeText)
            {
                // Our text is transitioning in.
                isTextTransitionIn = true;
                // We need to know how to deal with our text.
                yield return(StartCoroutine(GUI_Helper.TypeText(Grid_Helper.dialogueData.GetDialogueText(), 0.075f, dialogueTreeList[dialogueNode].prompt, typeSound)));

                // Our text is transitioning in.
                isTextTransitionIn = false;
            }
            // Handle setting up Reply Buttons if we have any.
            HandleReplys();
        }
Example #5
0
 private IEnumerator DialogueTextOut()
 {
     // IF we want the dialogue to fade,
     // ELSE IF we have the typed text OR instant text to transition out.
     if (fadeText)
     {
         // We fade the text.
         yield return(StartCoroutine(GUI_Helper.FadeText(dialogueComponent.dialogueText, textFadeTime, dialogueComponent.dialogueText.color.a, 0f)));
     }
     else if (typedText)
     {
         // No Coroutine needed but leaving this here incase you want to implement something.
     }
     else if (instantText)
     {
         // No Coroutine needed but leaving this here incase you want to implement something.
     }
     // Switch to a blank.
     dialogueComponent.SwitchText("");
 }
Example #6
0
 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.
     }
 }
        void Awake()
        {
            // Set the transform.
            _transform = gameObject.transform;
            _transform.position.Set(_transform.position.x, _transform.position.y, _transform.position.z + 50);
            // Grab the main Camera Component.
            _camera = Camera.main;
            // The Camera's width and height.
            cameraHeight = _camera.orthographicSize * 2;
            cameraWidth  = _camera.aspect * cameraHeight;

            // Set the UI offsets.
            topUILength   = (GUI_Helper.GetUILengthRatio(topUITag, false, Camera.main) / Screen.height) * cameraHeight;
            botUILength   = (GUI_Helper.GetUILengthRatio(bottomUITag, false, Camera.main) / Screen.height) * cameraHeight;
            leftUILength  = (GUI_Helper.GetUILengthRatio(leftUITag, true, Camera.main) / Screen.width) * cameraWidth;
            rightUILength = (GUI_Helper.GetUILengthRatio(rightUITag, true, Camera.main) / Screen.width) * cameraWidth;

            // The actual height and width that the player moves around in.
            innerHeight = cameraHeight - (topUILength + botUILength);
            innerWidth  = cameraWidth - (leftUILength + rightUILength);
        }
Example #8
0
 private IEnumerator DialogueOut()
 {
     // IF we want the dialogue to fade,
     // ELSE IF we want to shrink the dialogue,
     // ELSE IF we want the dialogue to disappear instantly.
     if (isFadeDialogue)
     {
         // Fade out the dialogue.
         StartCoroutine(GUI_Helper.FadeImage(dialogueComponent.dialogueImage, fadeTime, dialogueComponent.dialogueImage.color.a, 0f));
         // We fade the text.
         yield return(StartCoroutine(GUI_Helper.FadeText(dialogueComponent.dialogueText, fadeTime, dialogueComponent.dialogueText.color.a, 0f)));
     }
     else if (isGrowShrinkDialogue)
     {
         // Shrink the dialogue.
         yield return(StartCoroutine(GUI_Helper.GrowShrinkImage(dialogueComponent.dialogueImage, growShrinkTime, dialogueComponent.dialogueImage.transform.localScale.x, dialogueComponent.dialogueImage.transform.localScale.y, 0f, 0f)));
     }
     else if (isInstantDialogue)
     {
         // No Coroutine needed but leaving this here incase you want to implement something.
     }
     // Switch to a blank text.
     dialogueComponent.SwitchText("");
 }