private IEnumerator MoveOut()
    {
        _canvasGroup.interactable = false;

        var beg     = ContainerToMove.anchoredPosition;
        var end     = _origin + GetOffsetScreen(DirectionFrom);
        var routine = HelperTween.MoveRectTransformEnum(
            ContainerToMove,
            beg,
            end,
            Duration,
            Curve,
            true,
            () =>
        {
            ContainerToMove.gameObject.SetActive(false);
            if (ActionOnFinish != null)
            {
                ActionOnFinish.Invoke();
            }
        }
            );

        return(routine);
    }
Exemple #2
0
    public IEnumerator AnimEndPanel(string newScoreTxt, string bestScoreTxt)
    {
        if (UIContainerGameplay != null)
        {
            UIContainerGameplay.GetComponent <CanvasGroup>().interactable = false;

            var routineMoveGameplayUI = HelperTween.MoveRectTransformEnum(
                UIContainerGameplay,
                UIContainerGameplay.anchoredPosition,
                UIContainerGameplay.anchoredPosition +
                Vector2.up * UIContainerGameplay.rect.height,
                1f,
                AnimationCurve.EaseInOut(0f, 0f, 1f, 1f),
                true);

            yield return(StartCoroutine(routineMoveGameplayUI));
        }
        UIContainerEndPanel.gameObject.SetActive(true);

        var routine = HelperTween.MoveRectTransformEnum(
            UIContainerEndPanel,
            UIContainerEndPanel.anchoredPosition,
            Vector2.zero,
            1f,
            AnimationCurve.EaseInOut(0f, 0f, 1f, 1f),
            true);

        yield return(StartCoroutine(routine));


        var str    = newScoreTxt + "\n" + bestScoreTxt;
        var length = str.Length;

        for (float t = 0f, perc = 0f; perc < 1f; t += Time.unscaledDeltaTime)
        {
            perc = Mathf.Clamp01(t / DurationLetters);
            var nLetterToShow = (int)(length * perc);
            ScoreTxt.text = str.Substring(0, nLetterToShow);

            yield return(null);
        }

        routine = HelperTween.MoveRectTransformEnum(
            ButtonsEndPanel,
            ButtonsEndPanel.anchoredPosition,
            new Vector2(0f, 20f),
            1f,
            AnimationCurve.EaseInOut(0f, 0f, 1f, 1f),
            true);

        yield return(StartCoroutine(routine));

        ButtonsEndPanel.GetComponent <CanvasGroup>().interactable = true;
    }
Exemple #3
0
    private IEnumerator MoveText(string msg)
    {
        TextRound.text = msg;
        ContainerText.gameObject.SetActive(true);
        var length = (ContainerText.root as RectTransform).rect.width;
        var beg    = new Vector2(-length, 0f);

        yield return(HelperTween.MoveRectTransformEnum(
                         ContainerText,
                         beg,
                         beg + new Vector2(length * 2f, 0f),
                         DurationAnimText, CurveAnim, true));

        ContainerText.gameObject.SetActive(false);
    }
Exemple #4
0
    public void Quit()
    {
        StartScreen.GetComponent <CanvasGroup>().interactable = false;
        Debug.Log(Vector2.down * StartScreen.rect.height);
        var routine = HelperTween.MoveRectTransformEnum(
            StartScreen,
            StartScreen.anchoredPosition,
            StartScreen.anchoredPosition +
            Vector2.down * StartScreen.rect.height,
            1f,
            AnimationCurve.EaseInOut(0f, 0f, 1f, 1f),
            true,
            () => Application.Quit());

        StartCoroutine(routine);
    }
    private IEnumerator MoveIn()
    {
        ContainerToMove.gameObject.SetActive(true);
        var beg     = ContainerToMove.anchoredPosition;
        var end     = _origin;
        var routine = HelperTween.MoveRectTransformEnum(
            ContainerToMove,
            beg,
            end,
            Duration,
            Curve,
            true,
            () => _canvasGroup.interactable = true);

        return(routine);
    }
Exemple #6
0
    public void Play()
    {
        StartScreen.GetComponent <CanvasGroup>().interactable = false;
        Debug.Log(
            StartScreen.anchoredPosition);
        Debug.Log(
            StartScreen.anchoredPosition +
            Vector2.up * StartScreen.rect.height);
        var routine = HelperTween.MoveRectTransformEnum(
            StartScreen,
            StartScreen.anchoredPosition,
            StartScreen.anchoredPosition +
            Vector2.up * StartScreen.rect.height,
            1f,
            AnimationCurve.EaseInOut(0f, 0f, 1f, 1f),
            true,
            () => SceneManager.LoadScene(1));

        StartCoroutine(routine);
    }