In this chapter, we finished an important part of the game, the ending, either by victory or by defeat. We discussed a simple but powerful way to separate the different layers of responsibilities by using Managers created through Singletons, to guarantee that there's not more than one instance of every kind of manager and simplifying the connections between them through static access (something to consider the day you discover code testing). Also, we visited the concept of events to streamline the communication between Objects to prevent problems and create more meaningful communication between Objects.
With this knowledge, you are now able not only to detect the victory and lose conditions of the game but to also do that in a better-structured way. These patterns can be useful to improve our game code in general, and I recommend you to try to apply it in other relevant scenarios.
In the next chapter, we are going to explore how to create visual and audio feedback...