您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
42 行
1.1 KiB
42 行
1.1 KiB
using System;
|
|
using Assert = UnityEngine.Assertions.Assert;
|
|
|
|
namespace UnityEngine.Perception.Randomization.Samplers
|
|
{
|
|
/// <summary>
|
|
/// A struct representing a continuous range of values
|
|
/// </summary>
|
|
[Serializable]
|
|
public struct FloatRange
|
|
{
|
|
/// <summary>
|
|
/// The smallest value contained within the range
|
|
/// </summary>
|
|
public float minimum;
|
|
|
|
/// <summary>
|
|
/// The largest value contained within the range
|
|
/// </summary>
|
|
public float maximum;
|
|
|
|
/// <summary>
|
|
/// Constructs a float range
|
|
/// </summary>
|
|
/// <param name="min">The smallest value contained within the range</param>
|
|
/// <param name="max">The largest value contained within the range</param>
|
|
public FloatRange(float min, float max)
|
|
{
|
|
minimum = min;
|
|
maximum = max;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Assert whether this range is valid
|
|
/// </summary>
|
|
/// <exception cref="ArgumentException"></exception>
|
|
public void Validate()
|
|
{
|
|
Assert.IsTrue(minimum <= maximum);
|
|
}
|
|
}
|
|
}
|