Open andystopia opened 2 years ago
You can now pause bullets, turrets, and enemies, so that's progress.
Glad to see this working
On Sun, Jan 9, 2022 at 9:51 PM andystopia @.***> wrote:
You can now pause bullets, turrets, and enemies, so that's progress.
— Reply to this email directly, view it on GitHub https://github.com/Dmarsh12fitch/CircutBoardTowerDefense/issues/8#issuecomment-1008501486, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQXHMDG4FDMBZZPRVPEOG3UVJCRJANCNFSM5LQ2PIUQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
Motivation
We want to be able to pause the game.
Implementation.
There are several various ways to implement a pause behavior in a game; I think the one that I'm going to go for is a State Pattern which is probably the most theoretical of the common methods. A few disadvantages is that this will make the codebase larger than other implementations, but the tradeoff is that we save a branch condition for every object, which isn't a massive savings, but it isn't nothing either if we get into thousands of objects. Also more extensibility and a little more modularized code, so everything is kept nice tight little classes, which do very specific things.
To do implement this state pattern, every object will have a state manager, which will maintain which state is currently active by polymorphically swapping behaviors out depending on events it observes on a channel (a scriptable object IObservable) allowing cross scene state change communication.