protected virtual Damage.Result TakeDamage(float value, Damage.Method method, Entity cause) { if (Defense != null) { value = Defense.Sample(value); } var initialHealth = Health.Value; if (Health.Value > 0f) { Health.Value -= value; } else { } var result = new Damage.Result(value, this, method, cause); if (OnTookDamage != null) { OnTookDamage(result); } if (initialHealth > 0) { if (IsDead) { Death(result); } } return(result); }
public AttackData(float damage, int range, float distance, float duration, Damage.Method method) { this.power = damage; this.range = range; this.distance = distance; this.duration = duration; this.method = method; }
public virtual Damage.Result DoDamage(float value, Damage.Method method, Entity target) { if (Armed == false) { throw new InvalidOperationException("Cannot do damage from projectile " + name + " because it's not Armed yet, please Arm first"); } var result = Owner.DoDamage(value, method, target); return(result); }
public virtual Damage.Result DoDamage(float value, Damage.Method method, Entity target) { var result = target.TakeDamage(value, method, this); if (OnDoDamage != null) { OnDoDamage(result); } return(result); }