示例#1
0
 public void RemoveModifier(string id)
 {
     for (int i = 0; i < modifiers.Count; i++)
     {
         if (modifiers[i].id == id)
         {
             FloatModifier prev = modifiers[i];
             flatBonus    -= prev.flatBonus;
             percentBonus -= prev.percentBonus;
             BaseValue     = BaseValue;
             break;
         }
     }
 }
示例#2
0
 public void ClearModifier(string id)
 {
     modifiers = modifiers ?? new List <FloatModifier>();
     for (int i = 0; i < modifiers.Count; i++)
     {
         if (modifiers[i].id == id)
         {
             FloatModifier prev = modifiers[i];
             flatBonus    -= prev.flatBonus;
             percentBonus -= prev.percentBonus;
             modifiers.RemoveAt(i);
             break;
         }
     }
 }
示例#3
0
        public void SetModifier(string id, FloatModifier modifier)
        {
            modifiers = modifiers ?? new List <FloatModifier>();
            modifier  = new FloatModifier(id, modifier);

            for (int i = 0; i < modifiers.Count; i++)
            {
                if (modifiers[i].id == id)
                {
                    FloatModifier prev = modifiers[i];
                    flatBonus    -= prev.flatBonus;
                    percentBonus -= prev.percentBonus;
                    break;
                }
            }

            modifiers.Add(modifier);

            flatBonus    += modifier.flatBonus;
            percentBonus += modifier.percentBonus;
        }
示例#4
0
        public void SetModifier(string id, FloatModifier modifier)
        {
            modifier = new FloatModifier(id, modifier);

            for (int i = 0; i < modifiers.Count; i++)
            {
                if (modifiers[i].id == id)
                {
                    FloatModifier prev = modifiers[i];
                    flatBonus    -= prev.flatBonus;
                    percentBonus -= prev.percentBonus;
                    break;
                }
            }

            modifiers.Add(modifier);

            flatBonus    += modifier.flatBonus;
            percentBonus += modifier.percentBonus;

            BaseValue = BaseValue;     //weird but works
        }