Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         Destroy(collision.gameObject);
         scManager.PlayerKilled();
     }
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Missile"))
     {
         FindObjectOfType <AudioManager>().Play("PlayerHit");
         if (life == 2)
         {
             vie2.SetTrigger("Die");
             Destroy(collision.gameObject);
             life--;
             FindObjectOfType <AudioManager>().Play("MissileExplode");
             FindObjectOfType <AudioManager>().Stop("MissilePcht");
         }
         else if (life == 1)
         {
             vie1.SetTrigger("Die");
             Destroy(collision.gameObject);
             scManager.PlayerKilled();
             Destroy(this.gameObject);
         }
     }
 }