Numeric Value
🔢 NumericValue struct
The NumericValue
struct is used by the Scaling Value class to support multiple numeric types.
Namespace:
Esper.Inventool.Stats
Access:public
Type:struct
Attributes:[Serializable]
📦 Fields
public
numericType
NumericType
The numeric type.
public
value
Value
The value container.
🔧 Constructors
public
NumericValue(NumericType numericType, Value value)
Sets type and value container.
public
NumericValue(int value)
Creates an integer numeric value.
public
NumericValue(float value)
Creates a float numeric value.
🧰 Methods
public
SetValue(int value)
void
Sets value with type conversion.
public
SetValue(float value)
void
Sets value with type conversion.
public
SetValueWithConversion(int value)
void
Writes to integerValue
or converts to float based on numericType
.
public
SetValueWithConversion(float value)
void
Writes to floatValue
or truncates to int based on numericType
.
public
ToString()
string
Returns formatted string (0.##
for float).
public
ToStatValue(StatIdentity statIdentity)
StatValue
Converts to StatValue
.
public
ToFloat()
float
Converts to float
based on type.
public
ToInt()
int
Converts to int
based on type.
public
Equals(object obj)
bool
Equality using overloaded ==
.
public
GetHashCode()
int
Hash based on value
.
➗ Operator Overloads
/
NumericValue / float
NumericValue
Divides by a float.
/
NumericValue / int
NumericValue
Divides by an int.
/
NumericValue / NumericValue
NumericValue
Divides by another NumericValue
.
*
NumericValue * float
NumericValue
Multiplies by a float.
*
NumericValue * int
NumericValue
Multiplies by an int.
*
NumericValue * NumericValue
NumericValue
Multiplies by another NumericValue
.
+
NumericValue + float
NumericValue
Adds a float.
+
NumericValue + int
NumericValue
Adds an int.
+
NumericValue + NumericValue
NumericValue
Adds another NumericValue
.
-
NumericValue - float
NumericValue
Subtracts a float.
-
NumericValue - int
NumericValue
Subtracts an int.
-
NumericValue - NumericValue
NumericValue
Subtracts another NumericValue
.
==
NumericValue == NumericValue
bool
Equality check.
!=
NumericValue != NumericValue
bool
Inequality check.
>
NumericValue > NumericValue
bool
Greater‑than comparison.
<
NumericValue < NumericValue
bool
Less‑than comparison.
>=
NumericValue >= NumericValue
bool
Greater‑than‑or‑equal comparison.
<=
NumericValue <= NumericValue
bool
Less‑than‑or‑equal comparison.
==
NumericValue == float / int
bool
Equality against primitive.
!=
NumericValue != float / int
bool
Inequality against primitive.
>
/<
NumericValue >/< float / int
bool
Comparison against primitive.
>=
/<=
NumericValue >=/<= float / int
bool
Comparison against primitive.
implicit
int -> NumericValue
NumericValue
Implicit conversion from int.
implicit
float -> NumericValue
NumericValue
Implicit conversion from float.
implicit
NumericValue -> float
float
Implicit conversion to float.
implicit
NumericValue -> int
int
Implicit conversion to int.
🧩 Nested Types
public enum NumericType
public enum NumericType
Float
Represents a float value.
Integer
Represents an integer value.
public struct Value
public struct Value
integerValue
int
Backing integer value.
floatValue
float
Backing float value.
Creating a Numeric Value
// A numeric value with the value of 10 (use 10f if the numeric type should be Float)
NumericValue myNumericValue = 10;
Operators
You can use arithmetic and comparison operators for mathematical and comparison purposes.
Arithmetic Example
You can use arithmetic operators for a NumericValue
for mathematical purposes with another NumericValue
, int
, or float
value.
NumericValue valueC = valueA + valueB;
Comparison Example
You can use comparison operators for to compare a NumericValue
with another NumericValue
, int
, or float
value.
if (numericValueA >= numericValueB)
{
// Do something...
}
Last updated