In the Android app, there is a class responsible for counting down the time; class with the course of the game; singlet class with settings for different game parameters. The class with the course of the game must stop the game if the player dies. The countdown class should stop playing if time runs out. Which pattern is better to use in order to stop the classes at the same time and without creating strong links between them (the time is out -> stop the game, the player is dead -> stop the countdown)?
There are different game modes, the game mode for the time cited as an example, for this reason strong links between classes cannot be created.
At the moment, I have a parameter in the class with settings that stores the current state of the game (started, completed, paused, etc.) which has a setter that implements the pattern observer and notifies all subscribers when changing the state of the game, and In classes of time and the course of the game a listener of this event is implemented. But the code does not look elegant. Can you tell me a wiser decision?