Summary
In this chapter, we finished an important part of the game: the ending, both by victory and 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 isn’t more than one instance of every kind of manager and simplifying the connections between them through static access. Also, we visited the concept of events to streamline 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 loss conditions of the game but you can also do it in a better-structured way. These patterns can be useful to improve our game code in general, and I recommend you try to apply them in other relevant scenarios.
In the next chapter, we are going to start Section 3, Elevating Visuals, Effects, and Audio of the book, where we are going to see different...