So, Ive been developing a single-player open world survival game, over saturated I know but I promise there are no zombies at least. My goal is a very complex inventory system as I want this to me more of a simulation than a game, much like long dark if anyone is familiar with that but much more hardcore. Thus I need to like extend the regular item class into several other classes, like equipable, wieldable, usable, craftable, placeable, stackable. But I would also require these to be able to share multiple modifiers to the original class like an Item can be craftable and stackable or, equipable and craftable.
.
My Current setup for the item class is set up like this. An Item has the standard set of variables that all items have, but for the specifics eg, if an item is euippable it will have a bool flagging it and associated variables like so
bool edible;
float regenamount;
float regentime;
Now as I have started to implement more and more features of items I can see how this will develop into a massive problem where every time will have like 50 variables and more often than not they will only use around 10.
So my question is what is the best way I can account for this problem? My current thoughts is to have a List<Monodevelop> ItemModifiers
which will be held on the item class and will refer to the items modifiers meaning a seperate script called “Craftable Item” or “Equippalbe Item”. This method seems like it will solve the problem as items will only have the variables they need but it kind of sucks to refer to these scripts as I have to scan through the List of Item modifications to get their variables.
Anyway Im pretty new to unity and I dont want to continue with my inventory system as the longer I put off fixing it the harder it will be to fix.
anyhelp would be Much Appreciated Thank you