void HitTarget() { if (impactEffect != null) { GameObject effect = Instantiate(impactEffect, transform.position, transform.rotation) as GameObject; Destroy(effect, 5f); } if (target == null) { return; } Protester protester = target.GetComponent <Protester>(); if (protester != null) { if (damage > 0) { protester.Damage(damage + additionalDamage); } if (fear > 0) { protester.Scare(fear + additionalFear, parentTurret); } } Destroy(gameObject); }
void HitTarget(float damage, float fear) { Protester protester = target.GetComponent <Protester>(); if (protester != null) { if (damage > 0) { protester.Damage(damage); } if (fear > 0) { protester.Scare(fear, transform); } } }