public virtual bool tryToDealDamage(DamageSourceInfo source, out float damageDealt) { damageDealt = 0; if (isHurtByThisDamage(source)) { foreach (DamageSourceInfo.SourceValue sourceDamage in source.damageSources) { damageDealt += dealDamageWithSource(sourceDamage); } checkIfWeNeedToKillCharacter(); return(true); } return(false); }
public virtual bool isHurtByThisDamage(DamageSourceInfo source) { if (vunerablesList != null) { foreach (DamageVunerable dv in vunerablesList) { foreach (DamageSourceInfo.SourceValue sourceDamage in source.damageSources) { if (dv.vunerableTo(sourceDamage.source)) { return(true); } } } return(false); } return(false); }