Example #1
0
        /// <summary>
        /// Returns this property link's level between 0 and 1
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="property"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override float GetLevel(MMPropertyEmitter emitter, MMProperty property)
        {
            _vector3 = GetValueOptimized(property);

            float newValue = 0f;

            switch (emitter.Vector3Option)
            {
            case MMPropertyEmitter.Vector3Options.X:
                newValue = _vector3.x;
                break;

            case MMPropertyEmitter.Vector3Options.Y:
                newValue = _vector3.y;
                break;

            case MMPropertyEmitter.Vector3Options.Z:
                newValue = _vector3.z;
                break;
            }

            float returnValue = newValue;

            returnValue = MMMaths.Clamp(returnValue, emitter.FloatRemapMinToZero, emitter.FloatRemapMaxToOne, emitter.ClampMin, emitter.ClampMax);
            returnValue = MMMaths.Remap(returnValue, emitter.FloatRemapMinToZero, emitter.FloatRemapMaxToOne, 0f, 1f);

            emitter.Level = returnValue;
            return(returnValue);
        }
        /// <summary>
        /// Returns this property link's level between 0 and 1
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="property"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override float GetLevel(MMPropertyEmitter emitter, MMProperty property)
        {
            _vector2 = _getterSetterInitialized ? GetVector2Delegate() : (Vector2)GetPropertyValue(property);

            float newValue = 0f;

            switch (emitter.Vector2Option)
            {
            case MMPropertyEmitter.Vector2Options.X:
                newValue = _vector2.x;
                break;

            case MMPropertyEmitter.Vector2Options.Y:
                newValue = _vector2.y;
                break;
            }

            float returnValue = newValue;

            returnValue = MMMaths.Clamp(returnValue, emitter.FloatRemapMinToZero, emitter.FloatRemapMaxToOne, emitter.ClampMin, emitter.ClampMax);
            returnValue = MMMaths.Remap(returnValue, emitter.FloatRemapMinToZero, emitter.FloatRemapMaxToOne, 0f, 1f);

            emitter.Level = returnValue;
            return(returnValue);
        }
        /// <summary>
        /// Returns this property link's level between 0 and 1
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="property"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override float GetLevel(MMPropertyEmitter emitter, MMProperty property)
        {
            float      axisValue          = 0f;
            Quaternion propertyQuaternion = GetValueOptimized(property);

            switch (emitter.Vector3Option)
            {
            case MMPropertyEmitter.Vector3Options.X:
                axisValue = propertyQuaternion.eulerAngles.x;
                break;

            case MMPropertyEmitter.Vector3Options.Y:
                axisValue = propertyQuaternion.eulerAngles.y;
                break;

            case MMPropertyEmitter.Vector3Options.Z:
                axisValue = propertyQuaternion.eulerAngles.z;
                break;
            }
            axisValue = MMMaths.Clamp(axisValue, emitter.QuaternionRemapMinToZero, emitter.QuaternionRemapMaxToOne, emitter.ClampMin, emitter.ClampMax);

            float returnValue = MMMaths.Remap(axisValue, emitter.QuaternionRemapMinToZero, emitter.QuaternionRemapMaxToOne, 0f, 1f);

            emitter.Level = returnValue;
            return(returnValue);
        }
        /// <summary>
        /// Returns this property link's level between 0 and 1
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="property"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override float GetLevel(MMPropertyEmitter emitter, MMProperty property)
        {
            bool  boolValue   = GetValueOptimized(property);
            float returnValue = (boolValue == true) ? emitter.BoolRemapTrue : emitter.BoolRemapFalse;

            emitter.Level = returnValue;
            return(returnValue);
        }
        /// <summary>
        /// Returns this property link's level between 0 and 1
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="property"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override float GetLevel(MMPropertyEmitter emitter, MMProperty property)
        {
            float returnValue = GetValueOptimized(property);

            returnValue = MMMaths.Clamp(returnValue, emitter.IntRemapMinToZero, emitter.IntRemapMaxToOne, emitter.ClampMin, emitter.ClampMax);
            returnValue = MMMaths.Remap(returnValue, emitter.IntRemapMinToZero, emitter.IntRemapMaxToOne, 0f, 1f);

            emitter.Level = returnValue;
            return(returnValue);
        }
 /// <summary>
 /// Gets the raw value of the property, a normalized float value, caching the operation if possible
 /// </summary>
 /// <param name="emitter"></param>
 /// <param name="property"></param>
 /// <returns></returns>
 public override object GetValue(MMPropertyEmitter emitter, MMProperty property)
 {
     return(GetValueOptimized(property));
 }
Example #7
0
 /// <summary>
 /// Gets the raw value of the property, a normalized float value, caching the operation if possible
 /// </summary>
 /// <param name="emitter"></param>
 /// <param name="property"></param>
 /// <returns></returns>
 public virtual object GetValue(MMPropertyEmitter emitter, MMProperty property)
 {
     return(0f);
 }
Example #8
0
 /// <summary>
 /// Gets the "level" of the property, a normalized float value, caching the operation if possible
 /// </summary>
 /// <param name="emitter"></param>
 /// <param name="property"></param>
 /// <returns></returns>
 public virtual float GetLevel(MMPropertyEmitter emitter, MMProperty property)
 {
     return(0f);
 }
        /// <summary>
        /// Returns this property link's level between 0 and 1
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="property"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override float GetLevel(MMPropertyEmitter emitter, MMProperty property)
        {
            _color = _getterSetterInitialized ? GetColorDelegate() : (Color)GetPropertyValue(property);

            return(_color.MeanRGB());
        }