Upgrading Façades
There’s no rule in the Façade pattern that says you can only have a single type of façade, which means you may find yourself in situations where an abstract
base class comes in handy. While this isn’t something new or revolutionary for you object-oriented folks, you could have a Façade
class like the one in the following code that all other façades must implement:
public abstract class AbstractFacade : MonoBehaviour
{
public abstract IEnumerator Save(double score);
}
Then you could derive concrete subclasses any way you like – for example, different auto-save façades dealing with cloud and disk storage, as seen in the following snippet:
public class CloudStorageFacade : AbstractFacade
{
public override IEnumerator Save(double score)
{
yield break;
}
}
public class LocalStorageFacade : AbstractFacade
{
public override IEnumerator Save(double score)
{
yield break...