Well, I’m new to Unity and C# overall, and I’m trying to wrap my head around how to implement a first person inventory / item system.
As an example, Minecraft and CS2 have the kind of inventory system I’m aiming for.
I can pick an item up from the ground and store it in my inventory, as well as drop it back to the ground. I can also equip an item in my hand, which can then be used for whatever functionality it has.
What I’m struggling with is how to design items that share the same behavior but have different properties. For example, I could have a green flashlight that is stronger and has more battery, and a yellow flashlight that is weaker and has less battery. I could have both of them in my inventory at the same time, and maybe even two green flashlights, but they still need to be their own instances.
I also need to connect functionality with visuals. That means when I equip item X, it should play item X’s animation in the player’s hand, as well as its sounds and usage behavior.
I was thinking about using interfaces for item usage, but then I started wondering: what about items that can’t be used on their own, and instead need an interactable, like a door?
How would i store all of that, properties, behaviour, type etc?