I'm working on a relatively simple game, but even simple games have a lot of moving parts, and I'm running into some architecture issues. Just to be clear, everything works fine, but it feels dirty, and that's usually a sign of a problem.
So, I'm following SOLID principles, which, by my understanding means that I should have many scripts that each do a single thing versus large scripts that do many things. It makes things easier to maintain, but linking things that require references turns into a mess, for me at least.
To get more specific, my game uses a grid. Great, I've got a script that represents a grid and contains methods related to the grid (ex: converting from world to grid position).
I've got another script that instantiates the grid and manages things with the grid in a level, such as populating it. Then I've got a script that handles the merging logic for the items on the grid. (matching game logic)
Then, I've got a score manager that manages the game's score, and then I've got a UI manager that manages the UI.
The thing is that the merge script requires a hard reference to the grid to work, and the score manager requires a reference to the merge script, and the UI manager requires a reference to the score manager, and by the end of it, everything is referencing everything.
For the record, I'm trying to avoid inspector references, and instead referenced the main components using the Singleton pattern. But I don't like it.
Is there a better way?
The only thing I can think of is having a game manager script that references everything and then handles communication between all the other managers.