예제 #1
0
        /// <inheritdoc />
        protected override float GetRandomValue()
        {
            float setValue = RandomUtils.Float(MinValue, MaxValue);

            SnapIfSnappingEnabled(ref setValue, false);
            return(setValue);
        }
예제 #2
0
        /// <inheritdoc />
        protected override TColor GetRandomValue()
        {
            var color = ToColor(GetValue());

            color.r = RandomUtils.Float(0f, 1f);
            color.g = RandomUtils.Float(0f, 1f);
            color.b = RandomUtils.Float(0f, 1f);
            color.a = RandomUtils.Float(0f, 1f);
            return(FromColor(color));
        }
예제 #3
0
        /// <inheritdoc />
        protected override AnimationCurve GetRandomValue()
        {
            var curve = Value;
            var keys  = curve.keys;

            for (int n = keys.Length - 1; n >= 0; n--)
            {
                curve.keys[n] = new Keyframe(RandomUtils.Float(0f, float.MaxValue), RandomUtils.Float(float.MinValue, float.MaxValue));
            }
            curve.keys = keys;
            return(curve);
        }
예제 #4
0
        /// <inheritdoc />
        protected override Gradient GetRandomValue()
        {
            var gradient  = Value;
            var colorKeys = gradient.colorKeys;

            for (int n = colorKeys.Length - 1; n >= 0; n--)
            {
                var color = new Color(RandomUtils.Float(0f, 1f), RandomUtils.Float(0f, 1f), RandomUtils.Float(0f, 1f), RandomUtils.Float(0f, 1f));
                gradient.colorKeys[n] = new GradientColorKey(color, RandomUtils.Float(0f, 1f));
            }
            gradient.colorKeys = colorKeys;
            return(gradient);
        }
예제 #5
0
        /// <inheritdoc cref="IDrawer.GetRandomValue" />
        protected override object GetRandomValue()
        {
            var type = Type;

            if (type.IsPrimitive)
            {
                if (type == Types.Int)
                {
                    return(RandomUtils.Int());
                }
                else if (type == Types.Float)
                {
                    return(RandomUtils.Float(float.MinValue, float.MaxValue));
                }
                else if (type == Types.Char)
                {
                    return(RandomUtils.Char());
                }
                else if (type == Types.Bool)
                {
                    return(RandomUtils.Bool());
                }
                else if (type == Types.Double)
                {
                    return(RandomUtils.Double(double.MinValue, double.MaxValue));
                }
            }
            else if (type == Types.String)
            {
                return(RandomUtils.String(0, 100));
            }

                        #if DEV_MODE
            Debug.LogError(GetType().Name + " Randomize was not supported for type " + StringUtils.ToString(type));
                        #endif

            return(type.DefaultValue());
        }
예제 #6
0
 /// <inheritdoc cref="IDrawer.GetRandomValue" />
 protected override float GetRandomValue()
 {
     return(RandomUtils.Float(min, max));
 }
예제 #7
0
		/// <inheritdoc />
		protected override float GetRandomValue()
		{
			return RandomUtils.Float(-float.MaxValue, float.MaxValue);
		}