private IEnumerator FadeObjectIn(CanvasGroup cv, float moveAmount, float timeToWait)
    {
        yield return(new WaitForSeconds(timeToWait));

        StartCoroutine(UIAnimation.FadeIn(cv, 0.5f));
        iTween.MoveBy(cv.gameObject, iTween.Hash("y", moveAmount, "speed", 1.1f, "easeType", "easeInOutCubic", "delay", 0.1f));
    }
    /// <summary>
    /// This method is called everytime the entity enters a collider that is set to work as a trigger
    /// </summary>
    /// <param name="other"> the trigger that caused the collision</param>
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == triggerTag)
        {
            // Access the canvas group object of the current object
            CanvasGroup[] cvGroups = other.GetComponentsInChildren <CanvasGroup>();

            // The first canvas group will be the prompt text
            promptCanvasGroup = cvGroups[0];

            // The remaining objects are the containers
            for (int i = 1; i < cvGroups.Length; i++)
            {
                containers.Add(cvGroups[i]);
            }

            StartCoroutine(UIAnimation.FadeIn(promptCanvasGroup, dialoguePromptFadeTime * 3));

            foreach (CanvasGroup child in containers)
            {
                if (child.alpha == 1)
                {
                    hasInteractedWithDialogue = true;
                }
                else
                {
                    hasInteractedWithDialogue = false;
                }
            }

            canInteractWithDialogue = true;
        }
    }
    void FadeIn()
    {
        if (!shouldFadeUpwards)
        {
            moveAmount *= -1;
        }

        StartCoroutine(UIAnimation.FadeIn(cv, 1));
        iTween.MoveBy(cv.gameObject, iTween.Hash("y", moveAmount, "easeType", "easeInOutCubic"));
    }
Beispiel #4
0
    public void OnEnable()
    {
        StartCoroutine(UIAnimation.FadeIn(GetComponent <RectTransform>(), GetComponent <CanvasGroup>()));

        bool hasAnyChapters = ChapterManager.Instance.chapters.Count > 0;

        noChaptersWarning.SetActive(!hasAnyChapters);
        chaptersButton.interactable = hasAnyChapters;
        chaptersText.alignment      = hasAnyChapters ? TextAnchor.MiddleLeft : TextAnchor.UpperLeft;
    }
Beispiel #5
0
    public void TogglePause()
    {
        isPaused = !isPaused;

        if (!isPaused)
        {
            StartCoroutine(UIAnimation.FadeOut(cv, 0.5f));
        }
        else
        {
            StartCoroutine(UIAnimation.FadeIn(cv, 0.5f));
        }

        EventSystem.current.GetComponent <EventSystem>().SetSelectedGameObject(null);
    }
    public IEnumerator Transition(OnTransitionFinish onTransitionFinish)
    {
        float animTime = .5f;

        yield return(UIAnimation.FadeIn(GetComponent <RectTransform>(), GetComponent <CanvasGroup>(), animTime, .99f));

        yield return(new WaitForSeconds(10 * animTime));

        yield return(UIAnimation.FadeOut(GetComponent <RectTransform>(), GetComponent <CanvasGroup>(), animTime));

        onTransitionFinish();
        Canvass.sphereUIWrapper.SetActive(false);
        Canvass.sphereUIRenderer.SetActive(false);
        Canvass.sphereUIPanelWrapper.SetActive(true);
    }
    void Update()
    {
        if (canInteractWithDialogue)
        {
            // If the user presses E
            if (Input.GetKeyDown(interactionKey))
            {
                // Make the dialogue box visible
                if (!hasInteractedWithDialogue)
                {
                    iTween.MoveBy(promptCanvasGroup.gameObject, iTween.Hash("y", -0.4f, "easeType", "easeInOutExpo", "loopType", "none", "delay", 0.1f));

                    foreach (CanvasGroup child in containers)
                    {
                        StartCoroutine(UIAnimation.FadeIn(child, 0.5f));
                        iTween.MoveBy(child.gameObject, iTween.Hash("y", dialogueTranslateValue, "easeType", "easeInOutExpo", "loopType", "none", "delay", 0.1f));
                    }

                    hasInteractedWithDialogue = true;
                }
                // Make the dialogue box invisible
                else
                {
                    iTween.MoveBy(promptCanvasGroup.gameObject, iTween.Hash("y", 0.4f, "easeType", "easeInOutExpo", "loopType", "none", "delay", 0.1f));

                    foreach (CanvasGroup child in containers)
                    {
                        Invoke("FadeOutWithTime", 0.5f);
                        iTween.MoveBy(child.gameObject, iTween.Hash("y", -dialogueTranslateValue, "easeType", "easeInOutExpo", "loopType", "none", "delay", 0));
                    }

                    hasInteractedWithDialogue = false;
                }
            }     // !Input.GetKeyDown(KeyCode.E)
        }         // !canInteractWithDialogue
    }
Beispiel #8
0
 public void OnEnable()
 {
     StartCoroutine(UIAnimation.FadeIn(GetComponent <RectTransform>(), GetComponent <CanvasGroup>()));
 }