示例#1
0
 void Explode()
 {
     Instantiate(explodeParticle, transform.position, transform.rotation);
     Collider[] colliders = Physics.OverlapSphere(transform.position, explodeRadius);
     for (int i = 0; i < colliders.Length; i++)
     {
         Rigidbody rb = colliders[i].GetComponent <Rigidbody>();
         Flammable fm = colliders[i].GetComponent <Flammable>();
         if (rb != null)
         {
             rb.AddExplosionForce(1500f, transform.position, explodeRadius);
         }
         if (fm != null)
         {
             fm.Fire(10f);
         }
     }
     Destroy(gameObject);
 }