private void Start() { unit = GetComponent <Unit>(); damageBoostLvl = DamageBoostLvl.Level0; defenseBoostLvl = DefenseBoostLvl.Level0; unit.onTimedAttack += EvaluateDamageBoostLevel; unit.onTimedDefense += EvaluateDefenseBoostLevel; unit.parent.onDeath += OnDeath; }
private void EvaluateDamageBoostLevel(bool condition) { if (condition) { if (unit.HasMissedAllTargets) { return; } if (damageBoostLvl < DamageBoostLvl.Level5) { damageBoostLvl += 1; } else if (!unit.isBorrowing) { unit.parent.CurrentAP += 1; } } else { damageBoostLvl = DamageBoostLvl.Level0; } unit.onDmgValueChanged?.Invoke((int)damageBoostLvl, condition); }