Stats
v3.0
The Stats module (previously called "Stats and Skills") allows you to easily set up and access "Stat" data for your project. Creatively used, this could easily even add more functionality if
Stat
classes are used for other things, such as skills.A main concept of Stats is that each
Stat
object could potentially affect or be affected by others, and these values can be set up in the Inspector, and then utilized in your project in whatever way makes sense. Stat
values can also be affected by ItemObject
and ItemAttribute
objects.The script will automatically recalculate the final value of each
Stat
when the underlying data changes, meaning once it is set up in your code, the values should always remain up to date. You can choose to do these calculations directly however, if you do not want them to happen automatically.Quickstart Video #1 - Creating some Stats, an Item Object and Item Attribute and linking them all up in a demo scene.
As an example, you may set up a
Stat
called Experience which may hold the experience points a player has collected. You may also set up another Stat
called Experience Mod which is modifyable, but not trainable. Finally, you may set up a trainable Stat
called Learning, a skill which the player could learn, and then master / upgrade, throughout the game. Learning could be set to modify Experience Mod per "skill point", a value which may be something players can advance throughout the game. Perhaps Learning provides 0.02 points per skill point to Experience Mod.In the Inspector for Experience, you may choose to modify any "points" added to the
Stat
by the Experience Mod you set up. So instead of simply adding "100" to the Experience Stat
, the following math is used automatically:In this example, a player with 5 skill points on the Learning
Stat
would have a total modification to the Experience Mod of 0.1, and the 100 experience points will be worth 110 for this player.The goal of the
Stats
module is to make all of this relatively complex connections more easy to set up and manage, with runtime operations as automatic as possible. Time setting it all up, and thinking about how various Stat
objects can work together, can enable a very smooth operation later on.Last modified 1yr ago