private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Tower") { HealthComponent health = GetComponent <HealthComponent>(); if (health) { health.DealDamage(damage); } if (particleExplosion) { Instantiate(particleExplosion, transform.position, Quaternion.identity); } Destroy(gameObject); } }
public void OnHit(DamagePacket damagePacket, Vector3 hitPosition) { _healthComponent.DealDamage(damagePacket); }