private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         PM.damage(5);
     }
 }
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         int Damage = 1;
         PM.damage(Damage);
     }
 }
示例#3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         PM.damage(damage);
         Destroy(gameObject);
     }
     else if (collision.gameObject.tag == "Wall" || collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Bullet")
     {
         Destroy(gameObject);
     }
 }