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