public void Damage(int amount, float recoveringTime, RecoveringType recoveringType) { /*if (!Recovering) * {*/ if (recoveringType == RecoveringType.ConsidersRecover && Recovering) { return; } else { if (relatedDamageReceiver.GetDamageTag == AttackTag.Player) { if (ArenaManager.arenaManager != null) { ArenaManager.arenaManager.ScoreMng.IncreaseTakenDamages(amount); } } if (currentArmorAmount > 0) { currentArmorAmount -= amount; if (currentArmorAmount < 0) { amount = Mathf.Abs(currentArmorAmount); currentArmorAmount = 0; } else { amount = 0; } } currentLife -= Mathf.Abs(amount); #region Recover switch (recoveringType) { case (RecoveringType.ConsidersRecover): currentRecoveringTime = recoveringTime; break; case (RecoveringType.IgnoreRecoverDontSet): break; case (RecoveringType.IgnoreRecoverSetIfHigher): if (recoveringTime > currentRecoveringTime) { currentRecoveringTime = recoveringTime; } break; case (RecoveringType.IgnoreRecoverOverride): currentRecoveringTime = recoveringTime; break; case (RecoveringType.IgnoreRecoverAdd): currentRecoveringTime += recoveringTime; break; } #endregion relatedDamageReceiver.UpdateLifeBar(currentLife + currentArmorAmount); if (currentLife <= 0) { currentLife = 0; relatedDamageReceiver.Die(); } else { if (OnLifeChange != null) { OnLifeChange(relatedDamageReceiver); } } } //} }
public DamagesParameters(int amount, float recoverTime, RecoveringType recoverType) { damagesAmount = amount; recoveringTime = recoverTime; recoveringType = recoverType; }