public abstract void DealDamage(float amount); //Deals the given amount of damage. Different implementations can have different ways of handling this. //Must broadcast the "OnTakeDamage" message. public virtual void AttackFrom(DamageSource src) { //Gets this object attacked by src. Deals damage if vulnerable. if (CanBeHurtBy(src)) { DealDamage(src.damageAmount); src.BroadcastMessage("OnDealDamage", SendMessageOptions.DontRequireReceiver); } }