Scaling Value

Scripting with the ScalingValue class.

The ScalingValue class is a numeric value that can scale with level.

Fields & Properties

Name
Description
Type
Access

numericType

The numeric type.

NumericValue.NumericType

public

value

The current value.

NumericValue

public

excessValue

The last calculated excess value.

NumericValue

protected

scalingSource

The scaling source.

ScalingSource

public

level

The current level.

int

public

maxLevel

The max level.

int

public

lowValue

The low value.

NumericValue

public

HighValue

The value at the current level.

NumericValue

public

NextValue

The high value if leveled up.

NumericValue

public

MaxValue

The high value at the max level.

NumericValue

public

IsLevelMaxed

If the level is maxed.

bool

public

IsLow

If the current value is equal to the low value.

bool

public

IsHigh

If the current value is equal to the high value.

bool

public

Creating a Scaling Value

To create a ScalingValue, you need to define the scaling. This can be done by creating and providing the Scaling Source or by simply providing the appropriate values in the constructor.

The default current level set is 1 and the default max level set is the 'Default Max Level' value that you can set from Settings.

No Scaling

// Parameters: current, intitial
ScalingValue myScalingValue = new ScalingValue(100, 100);

Linear Scaling

// Parameters: current, intitial, increment
ScalingValue myScalingValue = new ScalingValue(100, 100, 10);

Curve Scaling

// Parameters: current, intitial, min, max, animation curve
ScalingValue myScalingValue = new ScalingValue(100, 100, 1, 100, myAnimationCurve);

Managing Levels

Setting the Level

To set the max value, use the SetMaxLevel method.

myScalingValue.SetMaxLevel(100);

The SetLevel will set the current level to a specific value.

myScalingValue.SetLevel(1);

Increasing the Level

Use the LevelUp method to increase the level by a given amount. This method returns the unused excess amount. The level cannot go over the max level.

myScalingValue.LevelUp(1);

Decreasing the Level

Use the LevelDown method to decrease the level by a given amount. This method returns the unused excess amount. The level cannot go lower than 1.

myScalingValue.LevelDown(1);

Optionally, you can use the Deplete method to set the level to 1.

myScalingValue.Deplete();

Last updated