Example #1
0
        /// <summary>
        /// Adds a flat modifier to the Attribute from a float and updates the ModsValue.
        /// If the AttributeType is Integer, the float will be truncated to an int
        /// Fires onAttributeChanged
        /// </summary>
        /// <param name="flatVal">The value to be added</param>
        /// <returns>The Created IAttributeMod</returns>
        public IAttributeMod AddFlatModifier(int flatVal)
        {
            IAttributeMod mod = new FlatAttributeMod(flatVal);

            _flatMods.Add(mod);

            _modsValue = CalculateMods();
            RaiseAttributeChanged();

            return(mod);
        }
Example #2
0
        /// <summary>
        /// Adds a flat modifier to the Attribute from an integer and updates the ModsValue.
        /// Fires onAttributeChanged
        /// </summary>
        /// <param name="flatVal">The value to be added</param>
        /// <returns>The Created IAttributeMod</returns>
        public IAttributeMod AddFlatModifier(float flatVal)
        {
            IAttributeMod mod;

            if (_type == AttributeType.Integer)
            {
                mod = new FlatAttributeMod((int)flatVal);
            }
            else
            {
                mod = new FlatAttributeMod(flatVal);
            }

            _flatMods.Add(mod);

            _modsValue = CalculateMods();
            RaiseAttributeChanged();

            return(mod);
        }