Exemplo n.º 1
0
    IEnumerator MoveTowardsOrb(ThrowingManager.ThrowAndDelete callback, SpellOrbController orb)
    {
        while (true)
        {
            // Move our position a step closer to the target.
            float step = speed * Time.deltaTime; // calculate distance to move
            transform.position = Vector3.MoveTowards(transform.position, target.position, step);

            yield return(new WaitForSeconds(0));

            // Check if the position of the cube and sphere are approximately equal.
            if (Vector3.Distance(transform.position, target.position) <= 0.3f)
            {
                callback(orb);
                break;
            }
        }
        Destroy(this.gameObject);
    }
Exemplo n.º 2
0
 public void StartMove(Transform tar, ThrowingManager.ThrowAndDelete callback, SpellOrbController orb)
 {
     target = tar;
     StartCoroutine(MoveTowardsOrb(callback, orb));
 }