Character Stats
Scripting with the CharacterStats class.
The CharacterStats
class is a component that can be used to provide stats to a GameObject
.
Fields & Properties
profile
The stat profile.
StatProfile
public
boundEquipment
The bound equipment instance. Use BindWithMain to set this value.
Equipment
public
Level
The current level. Use LevelUp, LevelDown, or SetLevel to change this value.
int
public
MaxLevel
The max level.
int
public
Weight
The amount the target weighs.
float
public
Experience
The experience points. Use AddExp or RemoveExp to manage this value.
ScalingValue
public
Durability
The durability points. Use AddDurability or ReduceDurability to manage this value.
ScalingValue
public
Stats
The list of stats.
List<Stat>
public
IsMaxed
If the level is maxed.
bool
public
Equipment Binding
Equipment binding is a way to link the stats of a character with the stats of equipped items. Combining logic is used for this.
Bind With Main
Use BindWithMain
to bind the main equipment.
Use Unbind
to unbind from the bound equipment.
Managing Stats
Adding/Removing Stats
To add or remove a stat, simply use the Add
or Remove
methods of the Stats
field.
Getting Stats
You can get a specific stat in the profile with the stat's ID, name or abbreviation.
Merging Stats
You can merge a list of stats with the MergeStats
method. Stat merging is the process of permanently adding a stat's value to another of the same identity. If the stat cannot be merged with any existing stat in the profile, it will be added as a new stat instead.
Combining/Uncombining Stats
Stat combining is the process of temporarily adding a stat's value to another of the same identity.
Combining
You can combine a list of stats with the CombineStats
method. Only similar stats can be combined with each other. Stats that aren't identical to any stat in the profile will be ignored.
Uncombining
Use the UncombineStats
method to have the opposite effect.
Managing Levels
When setting the level of a StatProfile
, the methods below should be used as they will update all stats in the profile.
Set the Level
To set the max value, use the SetMaxLevel
method.
The SetLevel
will set the current level to a specific value.
Level Up
The LevelUp
method increases the level by 1.
Level Down
The LevelDown
method decreases the level by 1.
Manage Experience
Add Exp
The AddExp
method adds experience points. This will result in a level up if the high value reached.
Remove Exp
The RemoveExp
method removes experience points. This will result in a level down if the value goes below zero.
Manage Durability
Increase Durability
The IncreaseDurability
method increases the durability. The durability cannot go over the high value.
Remove Exp
The ReduceDurability
method reduces the durability. The durability cannot go below the low value.
Last updated