com.javierquevedo.BubbleController.tweenTo C# (CSharp) Méthode

tweenTo() private méthode

private tweenTo ( Vector3 destination, float duration ) : IEnumerator
destination UnityEngine.Vector3
duration float
Résultat IEnumerator
        IEnumerator tweenTo(Vector3 destination, float duration)
        {
            float timeThrough = 0.0f;
            Vector3 initialPosition = transform.position;
            while (Vector3.Distance(transform.position, destination) >= 0.05){

                timeThrough += Time.deltaTime;
                Vector3 target = Vector3.Lerp(initialPosition, destination, timeThrough / duration);
                transform.position = target;
                yield return null;
            }
            transform.position = destination;
            if (this.GetComponent<Rigidbody>() == null){
                Destroy (this.gameObject);
            }
        }