To start off, we will implement a placeholder class that will mock the third-party inventory system as presented in the scenario of the previous section:
- The InventorySystem class provided by our fictional provider has three methods, AddItem(), RemoveItem(), and GetInventory(). All of these methods are hardcoded to use cloud storage and we can't modify them:
using UnityEngine;
using System.Collections.Generic;
namespace Chapter.Adapter
{
public class InventorySystem
{
public void AddItem(InventoryItem item)
{
Debug.Log(
"Adding item to the cloud");
}
public void RemoveItem(InventoryItem item)
{
Debug.Log(
"Removing item from the cloud");
}
public List<InventoryItem> GetInventory()
{
Debug.Log(
"Returning an inventory list stored in the cloud");
return new List<InventoryItem...