Example #1
0
        public override int calculate(ITezProperty <int> property)
        {
            float result = property.baseValue + m_SumBase + property.baseValue * m_MultBase;

            result = result + m_SumTotal + result * m_MultTotal;
            return(Mathf.RoundToInt(result));
        }
        /// <summary>
        /// 移除一个Modifier
        /// 并返回被操作的Property
        /// </summary>
        public bool removeModifier(ITezValueModifier modifier, out ITezProperty property)
        {
            var target = modifier.modifierConfig.target;

            property = this.get <ITezProperty>(target);
            return((property != null) && property.removeModifier(modifier));
        }
        /// <summary>
        /// 加入一个modifier
        /// 并返回被操作的property
        /// </summary>
        public bool addModifier(ITezValueModifier modifier, out ITezProperty property)
        {
            var target = modifier.modifierConfig.target;

            property = this.get <ITezProperty>(target);
            property?.addModifier(modifier);
            return(property != null);
        }
        private void onRefValueChanged(ITezProperty property)
        {
            var old = m_Value;

            switch (m_Property.valueType)
            {
            case TezValueType.Int:
                m_Value = ((ITezProperty <int>)m_Property).value;
                break;

            case TezValueType.Float:
                m_Value = ((ITezProperty <float>)m_Property).value;
                break;
            }

            this.notifyValueChanged(this, old);
        }
 public abstract T calculate(ITezProperty <T> property);