Ejemplo n.º 1
0
    private IEnumerator AnimateText(TextMeshProUGUI text, float speed, Vector3 target)
    {
        target.x = 0.0f;
        for (float i = 0.0f; i <= 1.0f; i += Time.deltaTime * speed)
        {
            Vector3 pos = Interpolation.BackOut(i) * target;
            text.transform.position = new Vector3(text.transform.position.x, pos.y);
            yield return(null);
        }

        text.transform.position = new Vector3(text.transform.position.x, target.y);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// A coroutine that displays the force field of an object.
    /// </summary>
    protected IEnumerator ProjectForceField()
    {
        float timer = 0;

        while (timer <= m_invincibilityDurationDelay)
        {
            timer += Time.deltaTime;
            float t = timer / m_invincibilityDurationDelay;
            t = Interpolation.BackOut(t);
            m_invincibilitySprite.transform.localScale = Vector3.LerpUnclamped(Vector3.zero, invincibiliySpriteNormalScale, t);
            Debug.Log(Vector3.LerpUnclamped(Vector3.zero, invincibiliySpriteNormalScale, t));
            yield return(null);
        }
    }