Esempio n. 1
0
 public override IEnumerator Apply(BallController ballController)
 {
     // Perform a sphere cast around the center of this effect's object.
     // Any other BrickController in this sphere will be obliterated
     RaycastHit[] hits = Physics.SphereCastAll(transform.position, effectRadius, transform.forward);
     foreach (RaycastHit hit in hits)
     {
         // Make sure that this object is actually inside the sphere
         // (its "distance" is set to 0 if that's the case)
         if (hit.distance == 0)
         {
             BrickController otherBrick = hit.collider.gameObject.GetComponent <BrickController>();
             if (otherBrick != null)
             {
                 otherBrick.DestroyBlock();
             }
         }
     }
     yield return(null);
 }