protected override void OnCollide(projectileAI projectile) { hitCount++; if (hitCount == 2) health = 0; Destroy(projectile.gameObject); }
/// <summary> /// When a projectile collides with this enemy object /// </summary> protected virtual void OnCollide(projectileAI projectile) { int damage; if ((damage = projectile.damage - armour) > 0) health -= damage; aSource.PlayOneShot(hitSound, 0.9f); if (drainDuration <= 0) { drainDamage = projectile.drainDamage; drainSpd = projectile.drainSpd; drainDuration += projectile.drainDuration; } Destroy(projectile.gameObject); }