To pause the game I have a family of objects that I pause the timescale of. The reason I don't set the game's timescale to 0 is because I wouldn't be able to navigate the menu properly with arrow keys since the game would be frozen. But I run into an unfortunate problem as a result of this method... 'Every X Second' events continue since they're system events, not object events...
If the mouse is held down, every 2 seconds the player will spawn a bullet. It works fine until I pause! It won't continue shooting bullets during pause, but the 'Every X Second' event will continue counting down - thus the player will shoot the moment you unpause as long as your mouse button is held down. This is incredibly game-breaking because it allows the player to shoot more bullets than they should..
So for example, if the player spawns a bullet, the system will start the 'Every 2 seconds' event and start counting down. The next bullet shouldn't spawn until 2 seconds later. But when you pause, the game still counts down... If you wait 2 seconds, you'll be able to unpause and shoot again immediately.
I tried to get around this by using timers... Since timers are an object behavior, if the object's timescale is set to 0, the timer will pause as well.
If the mouse is held down, on Timer (DPS) finished, spawn bullet. ... Since the timer only has an 'on timer finished' event, the player is required to have their mouse down during the time the timer finishes in order to spawn another bullet. If the Timer finishes and the player doesn't have their mouse button held down, you can never spawn a bullet ever again, so this method won't work.
Does anyone have a work-around? To be clear, I don't want to set the game's timescale to 0 because that freezes the menu, making it unsuable.
Thanks in advance!