Building a subsystem Façade
Imagine you’re building a 3D platformer game, and like all sensible games (Souls games notwithstanding), you want to provide a handy auto-saving feature that updates the saved score every three points your player scores or collects. However, there are several interconnected subsystem classes that handle different parts of this feature. For example, an auto-save feature might be responsible for pausing the game, converting the current score into a different format, and storing the converted value in a database or PlayerPrefs. Luckily, your team lead suggests you use a façade class to wrap and execute the subsystem details and give your client a simplified interface to call when auto-saving!
Defining subsystem objects
The first building block we need for our Façade pattern is a Façade
class (I didn’t see that coming either) to store an instance of each subsystem. In the Scripts folder, create a new C# script named...