Class Range
Inheritance
System.Object
Range
Assembly: Eco.Shared.dll
Syntax
[Serialized]
[BsonAutoSerialize]
public sealed class Range : ValueType, IBsonSerialize, IBsonSerializable, IBsonDeserializable
Constructors
Range(Single, Single)
Declaration
public Range(float min, float max)
Parameters
Type |
Name |
Description |
System.Single |
min |
|
System.Single |
max |
|
Fields
Invalid
Declaration
public static readonly Range Invalid
Field Value
max
Declaration
[Serialized]
public float max
Field Value
Type |
Description |
System.Single |
|
min
Declaration
[Serialized]
public float min
Field Value
Type |
Description |
System.Single |
|
Unlimited
Declaration
public static readonly Range Unlimited
Field Value
Zero
Declaration
public static readonly Range Zero
Field Value
Properties
Diff
Declaration
public float Diff { get; }
Property Value
Type |
Description |
System.Single |
|
IsValid
Declaration
public bool IsValid { get; }
Property Value
Type |
Description |
System.Boolean |
|
Max
Declaration
[JsonIgnore]
public float Max { get; set; }
Property Value
Type |
Description |
System.Single |
|
Mid
Declaration
public float Mid { get; }
Property Value
Type |
Description |
System.Single |
|
Min
Declaration
[JsonIgnore]
public float Min { get; set; }
Property Value
Type |
Description |
System.Single |
|
RandInt
Declaration
public int RandInt { get; }
Property Value
Type |
Description |
System.Int32 |
|
RandVal
Declaration
public float RandVal { get; }
Property Value
Type |
Description |
System.Single |
|
SimpleString
Declaration
public string SimpleString { get; }
Property Value
Type |
Description |
System.String |
|
Methods
Clamp(Single)
Declaration
public float Clamp(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Single |
|
Clamp0()
Make sure the range is >= 0
Declaration
ClampRange(Int32, Int32)
Declaration
public Range ClampRange(int min, int max)
Parameters
Type |
Name |
Description |
System.Int32 |
min |
|
System.Int32 |
max |
|
Returns
Distance(Single)
Declaration
public float Distance(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Single |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
ExpandFor(Single)
Declaration
public Range ExpandFor(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
ForEach(Action<Int32>)
Declaration
public void ForEach(Action<int> func)
Parameters
Type |
Name |
Description |
System.Action<System.Int32> |
func |
|
FromBson(BSONArray)
Declaration
public void FromBson(BSONArray bson)
Parameters
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
GetIncrement(Int32)
Declaration
public float GetIncrement(int count)
Parameters
Type |
Name |
Description |
System.Int32 |
count |
|
Returns
Type |
Description |
System.Single |
|
GetRandInt(Random)
Declaration
public int GetRandInt(Random random)
Parameters
Type |
Name |
Description |
System.Random |
random |
|
Returns
Type |
Description |
System.Int32 |
|
GetRandVal(Random)
Declaration
public float GetRandVal(Random random)
Parameters
Type |
Name |
Description |
System.Random |
random |
|
Returns
Type |
Description |
System.Single |
|
Grow(Single)
Declaration
public void Grow(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
GrowPercent(Single)
Declaration
public void GrowPercent(float percent)
Parameters
Type |
Name |
Description |
System.Single |
percent |
|
IdealRange(Single, Single)
Declaration
public float IdealRange(float val, float idealRange)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
System.Single |
idealRange |
|
Returns
Type |
Description |
System.Single |
|
InRangeExc(Single)
Declaration
public bool InRangeExc(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Boolean |
|
InRangeInc(Double)
Declaration
public bool InRangeInc(double val)
Parameters
Type |
Name |
Description |
System.Double |
val |
|
Returns
Type |
Description |
System.Boolean |
|
InRangeInc(Single)
Declaration
public bool InRangeInc(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Boolean |
|
InRangeLinearDist(Single)
Declaration
public bool InRangeLinearDist(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Boolean |
|
InRangeNormalDist(Single)
Declaration
public bool InRangeNormalDist(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Boolean |
|
Interpolate(Single)
Declaration
public float Interpolate(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Single |
|
MakeInclusive(Single, Single)
Declaration
public static Range MakeInclusive(float val1, float val2)
Parameters
Type |
Name |
Description |
System.Single |
val1 |
|
System.Single |
val2 |
|
Returns
Merge(Range)
Declaration
public Range Merge(Range range)
Parameters
Type |
Name |
Description |
Range |
range |
|
Returns
Overlaps(Range)
Declaration
public bool Overlaps(Range range)
Parameters
Type |
Name |
Description |
Range |
range |
|
Returns
Type |
Description |
System.Boolean |
|
PercentInMiddle(Single)
Declaration
public float PercentInMiddle(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Single |
|
PercentThrough(Single)
Declaration
public float PercentThrough(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Single |
|
PercentThroughQuadratic(Single)
Declaration
public float PercentThroughQuadratic(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
Type |
Description |
System.Single |
|
RoundToInt()
Roumd min down, and max up.
Declaration
RoundToMultiple(Single)
Roumd min down to the nearest multiple of 'val', and max up.
Declaration
public void RoundToMultiple(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Subtract(Range)
Declaration
public Range[] Subtract(Range subtract)
Parameters
Type |
Name |
Description |
Range |
subtract |
|
Returns
ToBson()
Declaration
public BSONArray ToBson()
Returns
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
WithinExclusive(Double, Double, Double)
Declaration
public static bool WithinExclusive(double value, double min, double max)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
System.Double |
min |
|
System.Double |
max |
|
Returns
Type |
Description |
System.Boolean |
|
WithinExclusive(Single, Single, Single)
Declaration
public static bool WithinExclusive(float value, float min, float max)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
System.Single |
min |
|
System.Single |
max |
|
Returns
Type |
Description |
System.Boolean |
|
Operators
Division(Range, Single)
Declaration
public static Range operator /(Range r, float v)
Parameters
Type |
Name |
Description |
Range |
r |
|
System.Single |
v |
|
Returns
Equality(Range, Range)
Declaration
public static bool operator ==(Range r1, Range r2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(Range, Range)
Declaration
public static bool operator !=(Range r1, Range r2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Multiply(Range, Single)
Declaration
public static Range operator *(Range r, float v)
Parameters
Type |
Name |
Description |
Range |
r |
|
System.Single |
v |
|
Returns
Implements
Extension Methods