/// <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);
        }
Ejemplo n.º 2
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)
        {
            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);
        }
Ejemplo n.º 4
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)
        {
            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);
        }