public void UseItem(Character character) { CharacterStats charStats = character.charStats; if (characterStat.Equals(StatName.CurrentHealthPoints)) { if (charStats.currentHealthPoints < charStats.totalHealthPoints) { int tempValue = charStats.currentHealthPoints + value; charStats.currentHealthPoints = Mathf.Clamp(tempValue, 0, charStats.totalHealthPoints); quantity--; if (guiController != null) { guiController.PlayItemSound(SoundType.ITEM_USED); } } else { if (guiController != null) { guiController.PlayItemSound(SoundType.ITEM_WRONG); } } } else if (characterStat.Equals(StatName.CurrentMagicPoints)) { if (charStats.currentMagicPoints < charStats.totalMagicPoints) { int tempValue = charStats.currentMagicPoints + value; charStats.currentMagicPoints = Mathf.Clamp(tempValue, 0, charStats.totalMagicPoints); quantity--; if (guiController != null) { guiController.PlayItemSound(SoundType.ITEM_USED); } } else { guiController.PlayItemSound(SoundType.ITEM_WRONG); } } if (quantity <= 0) { ItemsList.items.Remove(this); } }
public bool Equals(DestinyHistoricalStatsDefinition input) { if (input == null) { return(false); } return (( StatId == input.StatId || (StatId != null && StatId.Equals(input.StatId)) ) && ( Group == input.Group || (Group != null && Group.Equals(input.Group)) ) && ( PeriodTypes == input.PeriodTypes || (PeriodTypes != null && PeriodTypes.SequenceEqual(input.PeriodTypes)) ) && ( Modes == input.Modes || (Modes != null && Modes.SequenceEqual(input.Modes)) ) && ( Category == input.Category || (Category != null && Category.Equals(input.Category)) ) && ( StatName == input.StatName || (StatName != null && StatName.Equals(input.StatName)) ) && ( StatNameAbbr == input.StatNameAbbr || (StatNameAbbr != null && StatNameAbbr.Equals(input.StatNameAbbr)) ) && ( StatDescription == input.StatDescription || (StatDescription != null && StatDescription.Equals(input.StatDescription)) ) && ( UnitType == input.UnitType || (UnitType != null && UnitType.Equals(input.UnitType)) ) && ( IconImage == input.IconImage || (IconImage != null && IconImage.Equals(input.IconImage)) ) && ( MergeMethod == input.MergeMethod || (MergeMethod.Equals(input.MergeMethod)) ) && ( UnitLabel == input.UnitLabel || (UnitLabel != null && UnitLabel.Equals(input.UnitLabel)) ) && ( Weight == input.Weight || (Weight.Equals(input.Weight)) ) && ( MedalTierHash == input.MedalTierHash || (MedalTierHash.Equals(input.MedalTierHash)) )); }