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);
 }
예제 #2
0
    public void ChangeBounty(int value)
    {
        bounty += value;
        if (bounty < 0)
        {
            bounty = 0;
        }

        if (OnStatChange != null)
        {
            OnStatChange.Invoke();
        }
    }
예제 #3
0
 // 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);
 }
예제 #4
0
    public void ChangeSpeedStat(int value)
    {
        speed += value;
        if (speed < 1)
        {
            speed = 1;
        }

        if (OnStatChange != null)
        {
            OnStatChange.Invoke();
        }
    }
예제 #5
0
    public void ChangeDefenseStat(int value)
    {
        defense += value;
        if (defense < 1)
        {
            defense = 1;
        }

        if (OnStatChange != null)
        {
            OnStatChange.Invoke();
        }
    }
예제 #6
0
    public void ChangeAttackStat(int value)
    {
        attack += value;
        if (attack < 1)
        {
            attack = 1;
        }

        if (OnStatChange != null)
        {
            OnStatChange.Invoke();
        }
    }
예제 #7
0
    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;
        }
    }