private void ProcessHit(GC_DamageDealer damageDealer) { health -= damageDealer.GetDamage(); damageDealer.Hit(); if (health <= 0) { Die(); } }
private void OnTriggerEnter2D(Collider2D other) { GC_DamageDealer damageDealer = other.gameObject.GetComponent <GC_DamageDealer>(); if (!damageDealer) { return; } ProcessHit(damageDealer); }