Ejemplo n.º 1
0
    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);
        }
    }
Ejemplo n.º 2
0
 public void OnHit(DamagePacket damagePacket, Vector3 hitPosition)
 {
     _healthComponent.DealDamage(damagePacket);
 }