Exemple #1
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "projectile")
     {
         projectile proj = collider.GetComponentInParent <projectile>();
         proj.destroy();
         divideAsteroid();
     }
 }
Exemple #2
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "projectile")
     {
         projectile proj = collider.GetComponentInParent <projectile>();
         proj.destroy();
         int       i          = Random.Range(0, 100) % powerupNum;
         Rigidbody newPowerup = Instantiate(powerUps[i], transform.position, transform.rotation);
         Destroy(this.gameObject);
     }
 }