Hello,
I am making a game about washing dirty dishes. I have plate GameObjects and I want to attach certain substance scripts to them ex: cheese, spinach, ketchup. (Eventually will have a visual component.)
I want each substance object to have its own float subdata such as hardness, crunchiness, temperature, etc. that can be set to default values for each substance. (ex: 0.5, 0.1, etc.)
Particulars
- I want to do this in a way that has as much re-used code as possible. For instance I might like all of the scripts to realize that ‘temperature’ is a float without me having to re-code it in each substance, etc. Not really necessary but more of a best practices kind of thing.
-The subdata values can be changed dynamically on an instanced object. (i.e. cheese on an in-game plate can be made less hard by spraying it with water)
My thinking so far
I’m familiar with unity scripts, as well as the concept of objects and classes. I could just make a bunch of scripts, each w/ a class representing a different substance? This would then be instanced per plate GameObject automatically, according to the unity docs.
Regarding the subdata type, Two options:
1.) Forget the idea of making subdata types their own structure, since they’ll literally be floats, and just manually code them into each substance as needed.
2.) The actual subdata types would probably need to each have their own script/class also with a public member called value storing the actual float within.
It just seems like a lot of scripts to create.
Any guidance is appreciated. Thank you.