So I’ve currently have 2 controller-scripts in my game. One for the game level and one for the game board. The controller for the game board handles spawning new pieces and everything else on the board. The game level controller handles updating of scores and such.
Once the game is over, things should happen all over the places and there has to be a flag which says that the game is over.
My first thought is to have it in the game level controller, and the game board controller will look at that flag to check whether the game is over or not.
Is there any best practice for this type of thing?
To be honest, I don’t even know how to access a variable in another script, but I do know about the message layer.
Well, that depends on what game over means for them and how your design looks.
For a GUI game object it might mean disabling all UI nodes apart from a game over text node. No need to store state for that. Your board might just disable all input, remove all pieces or something like that.