Scaling Source

📈 ScalingSource Struct

The ScalingSource struct is used by a Scaling Value as the source to scale itself. It essentially works as the scaling settings.

Namespace: Esper.Inventool.Stats Access: public Type: struct Attributes: [Serializable]


📦 Fields

Access
Field
Type
Description

public

scalingType

ScalingType

How scaling is applied.

public

initialValue

NumericValue

The starting value.

public

increment

NumericValue

The scaling amount used for linear scaling.

public

min

NumericValue

The minimum value used for curved scaling.

public

max

NumericValue

The maximum value used for curved scaling.

public

curve

AnimationCurve

The scaling curve used when ScalingType.Curve is applied.


🧰 Constructors

Access
Constructor
Description

public

ScalingSource(NumericValue initialValue)

Creates a scaling source with type None.

public

ScalingSource(NumericValue initialValue, NumericValue increment)

Creates a scaling source with type Linear.

public

ScalingSource(NumericValue initialValue, NumericValue min, NumericValue max, AnimationCurve curve)

Creates a scaling source with type Curve.


🧰 Methods

Access
Method
Returns
Description

public

SetNumericType(NumericValue.NumericType numericType)

void

Sets the numeric type for all values.

public

GetScaledValue(int level, int maxLevel)

NumericValue

Gets the scaled value at a specific level.


🧩 Nested Types

public enum ScalingType

Name
Description

None

No scaling is applied. Only the initial value is used.

Linear

Scaling is applied linearly.

Curve

Scaling is based on a curve interpolating between min and max values.


Create a Scaling Source

// Linear scaling source
ScalingSource myScalingSource = new ScalingSource()
{
    scalingType = ScalingType.Linear, // Linear scaling
    initialValue = 10, // Set the initial stat value to 10 
    increment = 10, // Scale by 10 per level
};

Set Numeric Type

The SetNumericType method can be used to set the numeric type of the values.

myScalingSource.SetNumericType(NumericValue.NumericType.Integer);

Get Scaled Value

You can get the scaled value at a certain level with the GetScaledValue method. This requires 2 integers: the current level and the max level.

// Current level: 1, Max level: 100
var scaledValue = myScalingSource.GetScaledValue(1, 100);

Last updated