com.javierquevedo.BubbleController.scaleTo C# (CSharp) Method

scaleTo() private method

private scaleTo ( Vector3 scale, float duration ) : IEnumerator
scale UnityEngine.Vector3
duration float
return IEnumerator
        IEnumerator scaleTo(Vector3 scale, float duration)
        {
            float timeThrough = 0.0f;

            Vector3 initialScale = transform.localScale;

            while (transform.localScale.x >= 0.1){
                timeThrough += Time.deltaTime;
                Vector3 target = Vector3.Lerp(initialScale, scale, timeThrough / duration);
                transform.localScale = target;
                yield return null;
            }
            if (this.GetComponent<Rigidbody>() == null){
                Destroy (this.gameObject);
            }
        }