Hello,
I'm creating a space game where the players ship has many components that can upgraded as they progress. I keep getting myself in knots as I try to figure out how best to manage this. The player starts of with a basic version of everything e.g.
Basic Engine, Basic Hull, Basic Fuel Tank, etc....
Some of these components would rely on each other for example, the Engine needs to know if the fuel tank is empty. The fuel tank needs to know how much fuel the engine is burning so to reduce it's fuel amount.
What I started doing was to create a prefab for each component which holds the model and script. Each component script would inherit from a base script for each component type.
My idea was to then add and remove each prefab as children from a main Player prefab that would be the parent for all components and remain throughout the game.
I wasn't sure if to have a Component Manager on the Player prefab or maybe a Player Manager in the scene to control the lot. I then start to get stuck when I think about in the future and adding more component prefabs. Where do I reference these from? I'm going to need something that knows what components the player has bought, not just what they have installed.
Obviously the options don't stop there and I'm beginning to get buried in what I was hoping to keep as simple as possible.
Maybe this is a question of game management as a whole, not just a player. I think with Unity it can be very easy to get carried away with how to do graphics, sounds, moving your character around the screen but I realise that for me the most difficult part of game development is how to design the structure of the game. How your GameObjects load, intereact with each other, how they are saved, loaded and so on.
I would be interested on anyone's thoughts on this? Maybe a work flow you follow with Unity or a design pattern?
Thanks for your time, Dan