private void HitObject(GameObject hitObject) { HealthController2D hitObjectHealthController = hitObject.GetComponent <HealthController2D>(); if (hitObjectHealthController != null) { hitObjectHealthController.TakeDamage(currentAttack.attackDamage); } }
public override void ZoneEffect(GameObject effectedObject) { HealthController2D healthController = effectedObject.GetComponent <HealthController2D>(); if (healthController != null) { healthController.TakeDamage(zoneDamage); } }
public virtual void HitObject(GameObject hitObject) { Controller2D hitObjectController = hitObject.GetComponent <Controller2D>(); HealthController2D hitObjectHealthController = hitObject.GetComponent <HealthController2D>(); if (hitObjectController != null) { if (attackKnockbackDirection != Vector2.zero) { hitObjectController.SetNewStaticVelocity(attackKnockbackDirection, attackKnockbackTime); } } if (hitObjectHealthController != null) { hitObjectHealthController.TakeDamage(attackDamage); } }