public virtual void SetBuff(StatType type, StatModifier modifier) { if (modifier.Duration > 0) { StartCoroutine(SetBuffForDuration(type, modifier)); modifiers.Add(modifier); } else { Debug.Log($"Adding buff({modifier.Value}) to {type}"); GetStat(type).AddModifier(modifier); } onStatChange?.Invoke(type); }
public void ChangeBounty(int value) { bounty += value; if (bounty < 0) { bounty = 0; } if (OnStatChange != null) { OnStatChange.Invoke(); } }
// Returns false and does not deduct money if it would lead to a negative sum of money public bool ChangeMoneySum(int value) { if (money + value >= 0) { money += value; if (OnStatChange != null) { OnStatChange.Invoke(); } return(true); } return(false); }
public void ChangeSpeedStat(int value) { speed += value; if (speed < 1) { speed = 1; } if (OnStatChange != null) { OnStatChange.Invoke(); } }
public void ChangeDefenseStat(int value) { defense += value; if (defense < 1) { defense = 1; } if (OnStatChange != null) { OnStatChange.Invoke(); } }
public void ChangeAttackStat(int value) { attack += value; if (attack < 1) { attack = 1; } if (OnStatChange != null) { OnStatChange.Invoke(); } }
public void addValue(float mod) { CurrentValue += mod; if (OnStatChangeCallBack != null) { OnStatChangeCallBack.Invoke(); } if (CurrentValue == 0 && OnStatDepletedCallBack != null) { OnStatDepletedCallBack.Invoke(); } }
private void UpdateStatDisplay(StatType statType) { switch (statType) { default: OnStatChange.Invoke(statType); break; case StatType.MaxHealth: Health.FixCurrentValue(true); break; case StatType.MaxSpirit: Spirit.FixCurrentValue(true); break; } }