Skip to content

Instantly share code, notes, and snippets.

@justlev
Last active August 23, 2023 21:15
Show Gist options
  • Save justlev/af6dbdbeaec22adb1bed01504e6ed7e0 to your computer and use it in GitHub Desktop.
Save justlev/af6dbdbeaec22adb1bed01504e6ed7e0 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class MerchantBehaviour : MonoBehaviour, IMerchant
{
[SerializeField]
private InventoryBehaviour inventoryBehaviour;
[SerializeField]
private MerchantRaces race;
[SerializeField]
private string name;
void Initialize(string id, string name, MerchantRaces race, IInventory inventory)
{
Id = id;
this.name = name;
this.race = race;
inventoryBehaviour = null;
_inventory = inventory;
}
public string Id { get; private set; }
string IMerchant.Name { get { return this.name; } }
MerchantRaces IMerchant.Race { get { return this.race; } }
private IInventory _inventory;
IInventory IMerchant.Inventory
{
get
{
if (inventoryBehaviour != null) return inventoryBehaviour;
return _inventory;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment