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); } }
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); } }