public void DisplayAttributeDifference(Item selectedItem) { ItemAttribute attributeDifference = new ItemAttribute { Damage = selectedItem.damage, Defence = selectedItem.defence, Strength = selectedItem.strength, Intel = selectedItem.intel, Agility = selectedItem.agility }; attributeDifference.CalculateCompositeAttribute(); UpdateUiWithDifference(attributeDifference); }
private void UpdateUiWithDifference(ItemAttribute diff) { UpdateDataOnUi(); if (Math.Abs(diff.Damage) > Tolerance) { textDamage.text += GetValueWithSign(diff.Damage); } if (Mathf.Abs(diff.Strength) > Tolerance) { textStrength.text += GetValueWithSign(diff.Strength); } if (Mathf.Abs(diff.Intel) > Tolerance) { textIntel.text += GetValueWithSign(diff.Intel); } if (Mathf.Abs(diff.Agility) > Tolerance) { textAgility.text += GetValueWithSign(diff.Agility); } if (Mathf.Abs(diff.Defence) > Tolerance) { textDefence.text += GetValueWithSign(diff.Defence); } if (Mathf.Abs(diff.Hp) > Tolerance) { textHp.text += GetValueWithSign(diff.Hp); } if (Mathf.Abs(diff.Mana) > Tolerance) { textMana.text += GetValueWithSign(diff.Mana); } if (Mathf.Abs(diff.DodgeChance) > Tolerance) { textDodgeChance.text += GetValueWithSign(diff.DodgeChance); } if (Mathf.Abs(diff.CriticalRate) > Tolerance) { textCriticalRate.text += GetValueWithSign(diff.CriticalRate); } }
private void Awake() { _currentAttribute = new ItemAttribute(); _attributeDifference = new ItemAttribute(); }