- Home /
Stats component - properties
Hello, to keep desired properties of my object I have "MonoStats" component which have "Stats" object which in its definition doesnt inherits after mono and have properties like "Health", "Mana", "Speed".
It helps me a lot to easily serialize this class which contains all needed information about the object. Thanks that In each component if I need any kind of stat, like in "Run" component I would need "Speed" I simply do getComponent().Stats;
but what if I would like to have stats for not a person like above, but for weapon ? Which would have "Power", "Ammo" "ReloadTime" - so completely different set of properties?
Should I keep them in Stats as well, and just leave them set to "null" if not used?
Making component "MonoStatsWeapon" wouldn't help because what if I would like component "Shoot" be aplied once to the Gun Tower, and another time to the Soldier? The wouldn't have the same "MonoStats" and in getComponent I wouldn't know if I should get "MonoStatsPerson", or "MonoStatsWeapon".
Your answer
Follow this Question
Related Questions
Component Class Hierarchy 2 Answers
get component of gameobject that is type of base class 1 Answer
How should I give gameobjects health? 1 Answer
Class inheriting Runtime Classes 1 Answer