Im not sure how many of you have played final fantasy, but you have a team of up to 4 players, each of different stats.
I’m trying to achieve something similar.
Strength, Defense, Vitality etc so each player has its own individual stats.
Would it be best to store this all in one c# script, with a custom class holding these variables then have a list of these classes? Im not sure on what the best way to go about doing this would be.
Examples or a nudge in the right direction wouldn’t go a miss, thanks in advance!
In my rpg, I have a Creature class which has INT, STR, etc. variables, each of type Stat. I also have an array of those same objects to simplify bulk processing, and an enum that corresponds to the array positions for nice presentation in inspector variables. The player and every monster is an instance of Creature.
Having a Stat class allows me to store buffs etc. while still having the base stat values available. I also use it to encapsulate stat change messages as well as generating floating visual +1s.
But there is no “right” way. You might just have:
var INT : int;
var STR : int;
...
In you Player class. Indeed, I think that’s what I started with. It’s better to write simple, maintainable, evolvable code and refactor as-needed rather than to start with something that may be unnecessarily complicated.