// Use this for initialization void Start() { model = FindObjectOfType <InventoryModel>(); List <InventoryController> controllers = new List <InventoryController>(FindObjectsOfType <InventoryController>()); InventoryController.Inventory type = InventoryController.Inventory.Both; switch (inventoryType) { case Inventory.Ship: type = InventoryController.Inventory.Ship; break; case Inventory.Base: type = InventoryController.Inventory.Base; break; default: break; } controller = controllers.Find(x => x.inventoryType == type); }
public Slot(InventoryModel model, Item item = null, int amount = 0) { if (idManager == null) idManager = new IDManager(); this.id = idManager.GetNewID(); this.model = model; this.item = item; this.amount = amount; if (mappedSlots == null) mappedSlots = new Dictionary<int, Slot>(); mappedSlots.Add(id, this); }
// Use this for initialization void Start() { model = FindObjectOfType <InventoryModel>(); controller = FindObjectsOfType <InventoryController>(); }
private void SetInventoryModel(InventoryModel.Inventory invType, List <InventoryModel> allModels) { model = allModels.Find(model => model.inventoryType == invType); }