private void OnTriggerEnter2D(Collider2D col) { //Destroy(col.gameObject); BulletScript bullet = col.gameObject.GetComponent <BulletScript>(); bullet.Hit(); }
private void OnTriggerEnter2D(Collider2D collision) { BulletScript bullet = collision.gameObject.GetComponent <BulletScript>(); targetHealth -= bullet.GetDamage(); if (targetHealth <= 0) { Destroy(gameObject); } bullet.Hit(); }