Пример #1
0
    public override void TakeDamage(int damage)
    {
        base.TakeDamage(damage);

        //Update health bar UI.
        healthStatUI.SetValue(currentHealth);
    }
Пример #2
0
    void OnEquipmentChanged(Equipment newItem, Equipment oldItem)
    {
        if (newItem != null)
        {
            protection.AddModifier(newItem.armorModifier);
            strength.AddModifier(newItem.damageModifier);
        }

        if (oldItem != null)
        {
            protection.RemoveModifier(oldItem.armorModifier);
            strength.RemoveModifier(oldItem.damageModifier);
        }


        //Update protection and strength UI.
        protectionStatUI.SetValue(protection.GetValue());
        strengthStatUI.SetValue(strength.GetValue());
    }