Last active
August 23, 2023 21:15
-
-
Save justlev/af6dbdbeaec22adb1bed01504e6ed7e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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