Stat Scaling Source

📈 StatScalingSource Struct

The StatScalingSource struct is used by a Stat 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

ScalingSource.ScalingType

The scaling mode used (None, Linear, Curve).

public

initialValue

StatValue

The starting value.

public

increment

StatValue

The scaling amount used for linear scaling.

public

min

StatValue

The minimum value used for curve scaling.

public

max

StatValue

The maximum value used for curve scaling.

public

curve

AnimationCurve

The curve used when scaling type is Curve.


🧰 Constructors

Access
Constructor
Description

public

StatScalingSource(StatValue initialValue)

Creates a scaling source with no scaling.

public

StatScalingSource(StatValue initialValue, StatValue increment)

Creates a scaling source with linear scaling.

public

StatScalingSource(StatValue initialValue, StatValue min, StatValue max, AnimationCurve curve)

Creates a scaling source with curve scaling.


🧰 Methods

Access
Method
Returns
Description

public

SetIdentity(StatIdentity identity)

void

Sets the identity for all values (initialValue, increment, min, max).

public

GetScaledValue(int level, int maxLevel)

StatValue

Gets the scaled value at a specific level.

Create a Scaling Source

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

Set Identity

The SetIdentity method can be used to set the Stat Identity of the stat values.

myStatScalingSource.SetIdentity(myIdentity);

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 = myStatScalingSource.GetScaledValue(1, 100);

Last updated