Beispiel #1
0
 void OnTriggerEnter(Collider col)
 {
     if (col.name == "redlaser(Clone)" || col.tag == "PlayersLaser")
     {
         canisterHealth -= 10;
         if (canisterHealth <= 0)
         {
             Instantiate(explosion, col.transform.position, col.transform.rotation);
             bespinScript bscp = GameObject.Find("LevelManager").GetComponent <bespinScript>();
             bscp.canCount++;
             Destroy(col.gameObject);
             Destroy(gameObject);
         }
     }
     if (col.name == "protonTorpedo(Clone)")
     {
         canisterHealth -= 50;
         if (canisterHealth <= 0)
         {
             Instantiate(explosion, col.transform.position, col.transform.rotation);
             bespinScript bscp = GameObject.Find("LevelManager").GetComponent <bespinScript>();
             bscp.canCount++;
             Destroy(col.gameObject);
             Destroy(gameObject);
         }
     }
 }
Beispiel #2
0
 void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.tag == "Rebel")
     {
         bespinScript bscp = GameObject.Find("LevelManager").GetComponent <bespinScript>();
         bscp.canCount++;
         Destroy(gameObject);
     }
 }