easeInExpo() публичный статический Метод

public static easeInExpo ( float start, float end, float val ) : float
start float
end float
val float
Результат float
Пример #1
0
    private IEnumerator FadeElementIn(Image img, TextMeshProUGUI text, float time)
    {
        Color c3 = new Color(1f, 1f, 1f, 0f);
        Color c2 = new Color(1f, 1f, 1f, 1f);

        for (float t = 0f; t < time; t += Time.deltaTime)
        {
            float t2 = LeanTween.easeInExpo(0f, 1f, t / time);
            if (img != null)
            {
                img.color = Color.Lerp(c3, c2, t2);
            }
            if (text != null)
            {
                text.color = Color.Lerp(c3, c2, t2);
            }
            yield return(null);
        }
        if (img != null)
        {
            img.color = c2;
        }
        if (text != null)
        {
            text.color = c2;
        }
    }
Пример #2
0
 private IEnumerator ScaleElementUp(RectTransform rt, float time)
 {
     for (float t = 0f; t < time; t += Time.deltaTime)
     {
         rt.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, LeanTween.easeInExpo(0f, 1f, t / time));
         yield return(null);
     }
     rt.localScale = Vector3.one;
 }
Пример #3
0
 private IEnumerator ResizeElement(RectTransform element, float scaleFrom, float scaleTo, float time)
 {
     for (float t = 0f; t < time; t += Time.unscaledDeltaTime)
     {
         float t2 = LeanTween.easeInExpo(0f, 1f, t / time);
         element.localScale = Vector3.Lerp(Vector3.one * scaleFrom, Vector3.one * scaleTo, t2);
         yield return(null);
     }
     element.localScale = Vector3.one * scaleTo;
 }
Пример #4
0
    private IEnumerator MoveElement(RectTransform rt, Vector2 newPos, float time)
    {
        Vector2 origPos = rt.anchoredPosition;

        for (float t = 0f; t < time; t += Time.deltaTime)
        {
            rt.anchoredPosition = Vector2.Lerp(origPos, newPos, LeanTween.easeInExpo(0f, 1f, t / time));
            yield return(null);
        }
        rt.anchoredPosition = newPos;
    }
Пример #5
0
    private IEnumerator AnimateTextOut(TextMeshProUGUI text)
    {
        RectTransform rect        = text.rectTransform;
        Vector2       originalPos = rect.anchoredPosition;
        Vector2       endPos      = originalPos + Vector2.left * Screen.width;

        for (float t = 0f; t < 1f; t += Time.unscaledDeltaTime)
        {
            float t2 = LeanTween.easeInExpo(0f, 1f, t);
            rect.anchoredPosition = Vector2.Lerp(originalPos, endPos, t2);
            yield return(null);
        }
        text.gameObject.SetActive(value: false);
        rect.anchoredPosition = originalPos;
    }
Пример #6
0
    private IEnumerator AnimateUnlock()
    {
        AudioMap.PlayClipAt(AudioMap.instance["levelUnlock"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        CanvasGroup buttonCanvasGroup = unlockButton.GetComponent <CanvasGroup>();
        float       time = 0.4f;

        for (float t2 = 0f; t2 <= time; t2 += Time.deltaTime)
        {
            buttonCanvasGroup.alpha = LeanTween.easeOutExpo(1f, 0f, t2 / time);
            yield return(null);
        }
        unlockButton.gameObject.SetActive(value: false);
        CanvasGroup scoreCanvasGroup = scoreText.GetComponent <CanvasGroup>();

        CanvasGroup[] componentsInChildren = scoreText.GetComponentsInChildren <CanvasGroup>();
        CanvasGroup   scoreBgCanvasGroup   = scoreCanvasGroup;

        CanvasGroup[] array = componentsInChildren;
        foreach (CanvasGroup canvasGroup in array)
        {
            if (canvasGroup != scoreCanvasGroup)
            {
                scoreBgCanvasGroup = canvasGroup;
            }
        }
        scoreCanvasGroup.alpha   = 0f;
        scoreBgCanvasGroup.alpha = 0f;
        scoreText.gameObject.SetActive(value: true);
        for (float t2 = 0f; t2 <= time; t2 += Time.deltaTime)
        {
            float val = t2 / time;
            scoreCanvasGroup.alpha   = LeanTween.easeInExpo(0f, 1f, val);
            scoreBgCanvasGroup.alpha = LeanTween.easeInExpo(0f, 1f, val);
            yield return(null);
        }
        scoreCanvasGroup.alpha   = 1f;
        scoreBgCanvasGroup.alpha = 1f;
    }
Пример #7
0
    private IEnumerator ChestOpenAnimationRoutine(Rarity chestRarity)
    {
        rewardingDone       = false;
        chestExploded       = false;
        currentChestRewards = Variables.instance.GenerateChestRewards(chestRarity);
        PlayerDataManager.AddChestRewards(currentChestRewards);
        contentGridLayoutGroup.enabled = true;
        for (int j = 0; j != currentChestRewards.cards.Count; j++)
        {
            CardElement       component = UnityEngine.Object.Instantiate(cardPrefab).GetComponent <CardElement>();
            Card              card      = currentChestRewards.cards[j];
            ShopMenu.ShopItem item      = new ShopMenu.ShopItem
            {
                rarity = card.rarity,
                count  = card.count,
                id     = card.id,
                type   = ((card.type == CardType.TankCard) ? ShopMenu.ShopItemType.TankCard : ShopMenu.ShopItemType.BoosterCard),
                isNew  = card.isNew
            };
            shopItems.Add(item);
            AddElement(component);
            if (card.type == CardType.TankCard)
            {
                Tank tank = Variables.instance.GetTank(card.id);
                if (card.isNew)
                {
                    newCards.Push(new KeyValuePair <Collectible, CardElement>(tank, component));
                }
            }
        }
        if (currentChestRewards.gems > 0)
        {
            CardElement       component2 = UnityEngine.Object.Instantiate(cardPrefab).GetComponent <CardElement>();
            ShopMenu.ShopItem item2      = new ShopMenu.ShopItem
            {
                rarity = Rarity.Epic,
                count  = currentChestRewards.gems,
                type   = ShopMenu.ShopItemType.Gem
            };
            shopItems.Add(item2);
            AddElement(component2);
        }
        CardElement component3 = UnityEngine.Object.Instantiate(cardPrefab).GetComponent <CardElement>();

        ShopMenu.ShopItem item3 = new ShopMenu.ShopItem
        {
            rarity = chestRarity,
            count  = currentChestRewards.coins,
            type   = ShopMenu.ShopItemType.Coin
        };
        shopItems.Add(item3);
        AddElement(component3);
        LayoutRebuilder.ForceRebuildLayoutImmediate(contentGridLayoutGroup.GetComponent <RectTransform>());
        contentGridLayoutGroup.enabled = false;
        foreach (CardElement element in elements)
        {
            element.gameObject.SetActive(value: false);
        }
        chest.gameObject.SetActive(value: true);
        Image  image = chest;
        object sprite;

        switch (chestRarity)
        {
        default:
            sprite = commonChestSprite;
            break;

        case Rarity.Rare:
            sprite = rareChestSprite;
            break;

        case Rarity.Epic:
            sprite = epicChestSprite;
            break;
        }
        image.sprite = (Sprite)sprite;
        chest.SetNativeSize();
        yield return(new WaitForSeconds(currentOptions.shakeTime));

        AudioMap.PlayClipAt(AudioMap.instance["chestShake"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        LeanTween.delayedCall(currentOptions.windupTime - 0.367f, (Action) delegate
        {
            AudioMap.PlayClipAt(AudioMap.instance["chestWindup"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        });
        for (float time = 0f; time <= currentOptions.windupTime; time += Time.deltaTime)
        {
            chest.transform.rotation = Quaternion.Euler(0f, 0f, 50f * (Mathf.PingPong(time / 0.2f, 0.3f) - 0.2f));
            glowImage.color          = new Color(1f, 1f, 1f, LeanTween.easeInExpo(0f, 1f, time / currentOptions.windupTime));
            yield return(null);
        }
        chest.gameObject.SetActive(value: false);
        chest.transform.rotation = Quaternion.identity;
        currentOptions.explosion.Play();
        AudioMap.PlayClipAt(AudioMap.instance["chestOpen"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        if (chestRarity == Rarity.Epic)
        {
            AudioMap.PlayClipAt(AudioMap.instance["chestOpenChime"], Vector3.zero, AudioMap.instance.uiMixerGroup);
        }
        yield return(new WaitForSeconds(currentOptions.postExplosionWaitTime));

        doubleRewardsOfferButton.gameObject.SetActive(!isSubscribed);
        doubleRewardingDone = !isSubscribed;
        chestExploded       = true;
        MenuController.backButtonOverrideAction = FinishAnimation;
        int num;

        for (int i = 0; i < elements.Count; i = num)
        {
            if (!(elements[i] == null))
            {
                CardElement cardElement = elements[i];
                AudioMap.PlayClipAt(AudioMap.instance["cardReveal"], Vector3.zero, AudioMap.instance.uiMixerGroup);
                cardElement.gameObject.SetActive(value: true);
                cardElement.SetValues(shopItems[i], animateRoll: true, deductCount: true, isSubscribed);
                if (shopItems[i].type == ShopMenu.ShopItemType.TankCard && shopItems[i].isNew)
                {
                    SetNewCard(i);
                }
                if (shopItems[i].type == ShopMenu.ShopItemType.Coin)
                {
                    AnimatedCurrencyController.AnimateCoins(isSubscribed ? (shopItems[i].count / 2) : shopItems[i].count, MenuController.UICamera.WorldToViewportPoint(cardElement.transform.position), MenuController.TotalCoinsPositionViewport, 5, null, delegate(int ts)
                    {
                        MenuController.instance.topTotalCoinsText.Tick(ts);
                    });
                }
                else if (shopItems[i].type == ShopMenu.ShopItemType.Gem)
                {
                    AnimatedCurrencyController.AnimateGems(isSubscribed ? (shopItems[i].count / 2) : shopItems[i].count, MenuController.UICamera.WorldToViewportPoint(cardElement.transform.position), MenuController.TotalGemsPositionViewport, 1, null, delegate(int ts)
                    {
                        MenuController.instance.topTotalGemsText.Tick(ts);
                    });
                }
                yield return(new WaitForSeconds(0.25f));
            }
            num = i + 1;
        }
        if (isSubscribed)
        {
            doubleRewardRoutine = StartCoroutine(DoubleRewardsRoutine());
        }
        FinishAnimation();
    }
Пример #8
0
    private IEnumerator UnlockRoutine()
    {
        int     boughtIndex = tankIndex;
        Tank    boughtTank  = CurrentTank;
        float   time        = 0.2f;
        Vector2 boltPos     = lockBolt.anchoredPosition;

        for (float t = 0f; t < time; t += Time.deltaTime)
        {
            lockBolt.anchoredPosition = Vector2.Lerp(boltPos, boltPos + Vector2.up * 40f, LeanTween.easeInExpo(0f, 1f, t / time));
            yield return(null);
        }
        yield return(new WaitForSeconds(0.5f));

        SetTank(boughtIndex);
        MenuController.ShowMenu <NewCardPopup>().Init(boughtTank);
        lockBolt.anchoredPosition = boltPos;
    }
Пример #9
0
        public float GetValue(float start, float end, float t)
        {
            switch (Easing)
            {
            case LeanTweenType.notUsed:
                return(0f);

            case LeanTweenType.animationCurve:
                return(Mathf.Lerp(start, end, AnimationCurve.Evaluate(t)));

            case LeanTweenType.linear:
                return(LeanTween.linear(start, end, t));

            case LeanTweenType.easeOutQuad:
                return(LeanTween.easeOutQuad(start, end, t));

            case LeanTweenType.easeInQuad:
                return(LeanTween.easeInQuad(start, end, t));

            case LeanTweenType.easeInOutQuad:
                return(LeanTween.easeInOutQuad(start, end, t));

            case LeanTweenType.easeInCubic:
                return(LeanTween.easeInCubic(start, end, t));

            case LeanTweenType.easeOutCubic:
                return(LeanTween.easeOutCubic(start, end, t));

            case LeanTweenType.easeInOutCubic:
                return(LeanTween.easeInOutCubic(start, end, t));

            case LeanTweenType.easeInQuart:
                return(LeanTween.easeInQuart(start, end, t));

            case LeanTweenType.easeOutQuart:
                return(LeanTween.easeOutQuart(start, end, t));

            case LeanTweenType.easeInOutQuart:
                return(LeanTween.easeInOutQuart(start, end, t));

            case LeanTweenType.easeInQuint:
                return(LeanTween.easeInQuint(start, end, t));

            case LeanTweenType.easeOutQuint:
                return(LeanTween.easeOutQuint(start, end, t));

            case LeanTweenType.easeInOutQuint:
                return(LeanTween.easeInOutQuint(start, end, t));

            case LeanTweenType.easeInSine:
                return(LeanTween.easeInSine(start, end, t));

            case LeanTweenType.easeOutSine:
                return(LeanTween.easeOutSine(start, end, t));

            case LeanTweenType.easeInOutSine:
                return(LeanTween.easeInOutSine(start, end, t));

            case LeanTweenType.easeInExpo:
                return(LeanTween.easeInExpo(start, end, t));

            case LeanTweenType.easeOutExpo:
                return(LeanTween.easeOutExpo(start, end, t));

            case LeanTweenType.easeInOutExpo:
                return(LeanTween.easeInOutExpo(start, end, t));

            case LeanTweenType.easeInCirc:
                return(LeanTween.easeInCirc(start, end, t));

            case LeanTweenType.easeOutCirc:
                return(LeanTween.easeOutCirc(start, end, t));

            case LeanTweenType.easeInOutCirc:
                return(LeanTween.easeInOutCirc(start, end, t));

            case LeanTweenType.easeInBounce:
                return(LeanTween.easeInBounce(start, end, t));

            case LeanTweenType.easeOutBounce:
                return(LeanTween.easeOutBounce(start, end, t));

            case LeanTweenType.easeInOutBounce:
                return(LeanTween.easeInOutBounce(start, end, t));

            case LeanTweenType.easeInBack:
                return(LeanTween.easeInBack(start, end, t));

            case LeanTweenType.easeOutBack:
                return(LeanTween.easeOutBack(start, end, t));

            case LeanTweenType.easeInOutBack:
                return(LeanTween.easeInOutBack(start, end, t));

            case LeanTweenType.easeInElastic:
                return(LeanTween.easeInElastic(start, end, t));

            case LeanTweenType.easeOutElastic:
                return(LeanTween.easeOutElastic(start, end, t));

            case LeanTweenType.easeInOutElastic:
                return(LeanTween.easeInOutElastic(start, end, t));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }