easeInOutCirc() public static method

public static easeInOutCirc ( float start, float end, float val ) : float
start float
end float
val float
return float
Exemplo n.º 1
0
    private IEnumerator Start()
    {
        if (attachedVehicle.gameObject.layer == LayerMask.NameToLayer("PlayerTank"))
        {
            base.gameObject.layer = LayerMask.NameToLayer("ForceField");
        }
        else
        {
            base.gameObject.layer = LayerMask.NameToLayer("ForceFieldRight");
        }
        SpriteRenderer sr = GetComponent <SpriteRenderer>();

        sr.color        = new Color(0f, 0f, 0f, 0f);
        vehiclesDamaged = new HashSet <Vehicle>();
        float value = base.Booster.GetValue();
        float num   = Mathf.Lerp(minHealth, maxHealth, value);

        pushForce  = Mathf.Lerp(minPushForce, maxPushForce, value);
        fullHealth = (health = attachedVehicle.Stats.health * num);
        Vector3 position = attachedVehicle.transform.position;

        position.z = base.transform.position.z;
        base.transform.position   = position;
        base.transform.localScale = Vector3.zero;
        Bounds bounds = default(Bounds);

        for (int i = 0; i < attachedVehicle.spriteRenderers.Length; i++)
        {
            if (attachedVehicle.spriteRenderers[i] != null)
            {
                bounds.Encapsulate(attachedVehicle.spriteRenderers[i].transform.localPosition);
            }
        }
        AudioMap.PlayClipAt("forceFieldAppear", base.transform.position, AudioMap.instance.effectsMixerGroup);
        float   forceFieldScale = attachedVehicle.forceFieldScale;
        Vector3 targetScale     = new Vector3(forceFieldScale, forceFieldScale, 1f);

        for (float t = 0f; t < 0.5f; t += Time.deltaTime)
        {
            if (base.transform == null || sr == null)
            {
                yield break;
            }
            float t2 = LeanTween.easeInOutCirc(0f, 1f, t / 0.5f);
            base.transform.localScale = Vector3.Lerp(Vector3.zero, targetScale, t2);
            if (t > 0.3f)
            {
                float t3 = LeanTween.easeInOutCirc(0f, 1f, (t - 0.3f) / 0.2f);
                sr.color = Color.Lerp(new Color(1f, 1f, 1f, 0f), Color.white, t3);
            }
            yield return(null);
        }
        base.transform.localScale = targetScale;
        sr.color = Color.white;
    }
Exemplo n.º 2
0
    private void Update()
    {
        t += Time.unscaledDeltaTime * speed;
        if (t > 2f)
        {
            t -= 2f;
        }
        float val = Mathf.PingPong(t, 1f);
        float num = LeanTween.easeInOutCirc(0f, 1f, val);

        base.transform.localScale = Vector3.Lerp(min, max, num);
    }
Exemplo n.º 3
0
    private IEnumerator AnimateTextIn(TextMeshProUGUI text)
    {
        RectTransform rect        = text.rectTransform;
        Vector2       originalPos = rect.anchoredPosition;
        Vector2       startPos    = rect.anchoredPosition = originalPos + Vector2.right * Screen.width;

        text.gameObject.SetActive(value: true);
        for (float t = 0f; t < 1f; t += Time.unscaledDeltaTime)
        {
            float t2 = LeanTween.easeInOutCirc(0f, 1f, t);
            rect.anchoredPosition = Vector2.Lerp(startPos, originalPos, t2);
            yield return(null);
        }
    }
Exemplo n.º 4
0
    private IEnumerator ScrollRoutine(Section section)
    {
        Vector2 min       = contentContainer.offsetMin;
        Vector2 max       = contentContainer.offsetMax;
        Vector2 targetMin = new Vector2(min.x, 0f);
        Vector2 targetMax = new Vector2(max.x, contentHeight);

        switch (section)
        {
        case Section.DailyOffers:
            targetMin.y = 0f - contentHeight;
            targetMax.y = 0f;
            break;

        case Section.Chests:
            targetMin.y -= chestsSection.rect.height;
            targetMax.y -= chestsSection.rect.height;
            goto case Section.Subscriptions;

        case Section.Subscriptions:
            if (subscriptionSection.gameObject.activeSelf)
            {
                targetMin.y -= subscriptionSection.rect.height;
                targetMax.y -= subscriptionSection.rect.height;
            }
            goto case Section.Gems;

        case Section.Gems:
            targetMin.y -= gemsSection.rect.height;
            targetMax.y -= gemsSection.rect.height;
            break;
        }
        float time = 0.4f;

        for (float t = 0f; t < time; t += Time.deltaTime)
        {
            float t2 = LeanTween.easeInOutCirc(0f, 1f, t / time);
            contentContainer.offsetMin = Vector2.Lerp(min, targetMin, t2);
            contentContainer.offsetMax = Vector2.Lerp(max, targetMax, t2);
            yield return(null);
        }
        contentContainer.offsetMin = targetMin;
        contentContainer.offsetMax = targetMax;
        scrollRoutine = null;
    }
Exemplo n.º 5
0
    private IEnumerator OnBossIntro(TankGame game, Enemy boss)
    {
        pauseBlocked = true;
        progressBar.gameObject.SetActive(value: false);
        otherThanBossContainer.SetActive(value: false);
        bossContainer.SetActive(value: true);
        boss.vehicleContainer.SetHealthBar(bossHealthbar, bossHealthbarBase);
        bossName.text = ScriptLocalization.Get(boss.settings.name);
        bossName.SetNativeSize();
        Vector2 origPos    = BossNameOriginalPosition;
        Vector3 origScale  = BossNameOriginalScale;
        Vector3 largeScale = origScale * 1.2f;
        Vector2 startPos   = MenuBase <GameMenu> .instance.bossName.rectTransform.anchoredPosition + new Vector2(Screen.width * 2, -250f);
        Vector2 endPos     = MenuBase <GameMenu> .instance.bossName.rectTransform.anchoredPosition + new Vector2(-250f, -250f);

        bossName.rectTransform.anchoredPosition = startPos;
        bossName.transform.localScale           = largeScale;
        bossHealthbarBase.gameObject.SetActive(value: false);
        for (float t6 = 0f; t6 < 1f; t6 += Time.deltaTime)
        {
            yield return(null);
        }
        otherThanBossContainer.gameObject.SetActive(value: false);
        TankGame.instance.playerTankContainer.SetSpeed(0f, 0f);
        game.cameraFollowTransform = boss.vehicleContainer.cameraFollowTransform;
        for (float t6 = 0f; t6 < 1.5f; t6 += Time.deltaTime)
        {
            yield return(null);
        }
        AudioManager.SetGameAudioTo(-80f);
        Time.timeScale = 0f;
        for (float t6 = 0f; t6 < 0.5f; t6 += Time.unscaledDeltaTime)
        {
            float t7 = Mathf.Clamp01(LeanTween.easeInOutCirc(0f, 1f, Mathf.Clamp01(t6 / 0.5f)));
            bossName.rectTransform.anchoredPosition = Vector2.Lerp(startPos, endPos, t7);
            yield return(null);
        }
        for (float t6 = 0f; t6 < 1.5f; t6 += Time.unscaledDeltaTime)
        {
            yield return(null);
        }
        AudioManager.SetGameAudioTo(0f);
        Time.timeScale = 1f;
        for (float t6 = 0f; t6 < 0.5f; t6 += Time.deltaTime)
        {
            float t8 = Mathf.Clamp01(LeanTween.easeInOutCirc(0f, 1f, Mathf.Clamp01(t6 / 0.5f)));
            bossName.rectTransform.anchoredPosition = Vector3.Lerp(endPos, origPos, t8);
            bossName.transform.localScale           = Vector3.Lerp(largeScale, origScale, t8);
            yield return(null);
        }
        for (float t6 = 0f; t6 < 0.5f; t6 += Time.deltaTime)
        {
            yield return(null);
        }
        otherThanBossContainer.gameObject.SetActive(value: true);
        bossHealthbarBase.gameObject.SetActive(value: true);
        bossHealthbar.GetComponent <Image>().fillAmount = 0f;
        bossName.rectTransform.anchoredPosition         = origPos;
        bossName.transform.localScale = origScale;
        game.cameraFollowTransform    = (game.playerTankContainer.cameraFollowTransform ? game.playerTankContainer.cameraFollowTransform : game.playerTankContainer.transform);
        pauseBlocked = false;
    }
Exemplo n.º 6
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();
            }
        }