예제 #1
0
 public StatModifier(float value, ModiferType type, int order, object source) : this()
 {
     _value  = value;
     _type   = type;
     _order  = order;
     _source = source;
 }
예제 #2
0
        public virtual void UpdateAmount(float amount, bool increase, ModiferType type)
        {
            float finalAmount   = Amount;
            float sumPercentAdd = 0;

            if (increase)
            {
                if (type == ModiferType.Flat)
                {
                    Amount += amount;
                }

                else if (type == ModiferType.AddPercent)
                {
                    sumPercentAdd += amount;

                    finalAmount *= 1 + sumPercentAdd;

                    sumPercentAdd = 0;

                    Amount = finalAmount;
                }
                else if (type == ModiferType.MultPercent)
                {
                    finalAmount *= 1 + amount;
                    Amount       = finalAmount;
                }
            }
            else
            {
                if ((Amount - amount) >= 0)
                {
                    Amount -= amount;
                }
                else
                {
                    Amount = 0;
                }
            }
        }
예제 #3
0
 public StatModifier(float value, ModiferType type, object source) : this(value, type, 0, source)
 {
 }
예제 #4
0
 public StatModifier(float value, ModiferType type, int order) : this(value, type, order, null)
 {
 }
예제 #5
0
 public StatModifier(float value, ModiferType type) : this(value, type, 0, null)
 {
 }