Upgrading Stats

How to upgrade or downgrade stats.

Upgrade/Downgrade

From UnitStatsProvider

Upgrade

Call UnitStatsProvider.LevelUp whenever the unit should level up. This will update all the stats to reflect the unit's current level (the base and current max values will be updated).

// Where statsProvider is a UnitStatsProvider object
statsProvider.LevelUp();

Downgrade

Use LevelDown to have the opposite effect.

// Where statsProvider is a UnitStatsProvider object
statsProvider.LevelDown();

From UnitStats

UnitStats is a serializable class that is used by UnitStatsProvider to store level and stat data. You can use the SetLevel method to set all UpgradableStats to a specific level.

// Where unitStats is a UnitStats object
// Setting level to 1
unitStats.SetLevel(1);

From UpgradableStat

Upgrade

// Where hp is an UpgradableStat
hp.TryUpgrade();

Downgrade

// Where hp is an UpgradableStat
hp.TryDowngrade();

Last updated