/// <inheritdoc /> protected override void DoRandomize() { if (RandomUtils.Bool()) { OnClick(Event.current); } }
/// <inheritdoc /> protected override object GetRandomValue() { if (RandomUtils.Bool()) { return(null); } else { return(Type.DefaultValue()); } }
/// <inheritdoc /> protected override void DoRandomize() { if (RandomUtils.Bool()) { Value = null; } else { Value = Type.DefaultValue(); if (!IsNull) { ValueDrawer.Randomize(false); } } }
/// <inheritdoc /> protected override void DoRandomize() { if (RandomUtils.Bool()) { SetValue(null); } else { var randomizer = ValueDrawer; if (randomizer == null) { SetValue(Type.DefaultValue()); randomizer = ValueDrawer; } if (randomizer != null) { randomizer.Randomize(false); } } }
/// <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()); }
/// <inheritdoc /> protected override bool GetRandomValue() { return(RandomUtils.Bool()); }
/// <inheritdoc /> protected override TimeSpan GetRandomValue() { var min = TimeSpan.MinValue; var max = TimeSpan.MaxValue; bool positive = RandomUtils.Bool(); int days, hours, minutes, s, ms; if (positive) { days = Random.Range(0, max.Days + 1); hours = Random.Range(0, 24); minutes = Random.Range(0, 60); s = Random.Range(0, 60); ms = Random.Range(0, 1000); if (days == max.Days) { hours = Random.Range(0, max.Hours + 1); if (hours == max.Hours) { minutes = Random.Range(0, max.Minutes + 1); if (minutes == max.Minutes) { s = Random.Range(0, max.Seconds + 1); if (s == max.Seconds) { ms = Random.Range(0, max.Milliseconds + 1); } } } } } else { days = Random.Range(min.Days, 1); hours = Random.Range(-23, 1); minutes = Random.Range(-59, 1); s = Random.Range(-59, 1); ms = Random.Range(-999, 1); if (days == min.Days) { hours = Random.Range(min.Hours, 1); if (hours == min.Hours) { minutes = Random.Range(min.Minutes, 1); if (minutes == min.Minutes) { s = Random.Range(min.Seconds, 1); if (s == min.Seconds) { ms = Random.Range(min.Milliseconds, 1); } } } } } return(new TimeSpan(days, hours, minutes, s, ms)); }