2019-01-26 00:39:37 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles.DataTypes
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-02-01 18:40:39 +00:00
|
|
|
|
public class NumberRange
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
public readonly float Min;
|
|
|
|
|
public readonly float Max;
|
|
|
|
|
|
2019-11-01 02:40:31 +00:00
|
|
|
|
public override string ToString() => $"{Min} {Max}";
|
|
|
|
|
|
2019-06-30 22:01:19 +00:00
|
|
|
|
public NumberRange(float num)
|
|
|
|
|
{
|
|
|
|
|
Min = num;
|
|
|
|
|
Max = num;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-01 02:40:31 +00:00
|
|
|
|
private static void checkRange(float min, float max)
|
|
|
|
|
{
|
|
|
|
|
if (max - min >= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
throw new Exception("NumberRange: invalid range");
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-01 18:40:39 +00:00
|
|
|
|
public NumberRange(float min = 0, float max = 0)
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-11-01 02:40:31 +00:00
|
|
|
|
checkRange(min, max);
|
2019-01-26 00:39:37 +00:00
|
|
|
|
|
|
|
|
|
Min = min;
|
|
|
|
|
Max = max;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-01 02:40:31 +00:00
|
|
|
|
internal NumberRange(Attribute attr)
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-11-01 02:40:31 +00:00
|
|
|
|
float min = attr.readFloat();
|
|
|
|
|
float max = attr.readFloat();
|
|
|
|
|
|
|
|
|
|
checkRange(min, max);
|
|
|
|
|
|
|
|
|
|
Min = min;
|
|
|
|
|
Max = max;
|
2019-01-26 00:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|