private void OnTriggerEnter2D(Collider2D collision) { EnemyShieldHealth enemyShield = collision.GetComponentInChildren <EnemyShieldHealth>(); if (enemyShield) { enemyShield.TakeDamage(DamageToRemoveShield); } }
private void OnTriggerEnter2D(Collider2D collider) { if (collider.CompareTag("Enemy")) { _objectPoolManager.RecycleObject(collider.gameObject); } if (collider.CompareTag("ShieldEnemy")) { EnemyShieldHealth enemyShield = collider.GetComponentInChildren <EnemyShieldHealth>(); // only destroy the shield enemy when he doesnt have more shield if (enemyShield && !enemyShield.ShieldIsActive) { _objectPoolManager.RecycleObject(collider.gameObject); } } }