public static GameObject makeItem(Equipment equipment) { GameObject item = GameObject.Instantiate(Resources.Load("ui/InventoryItem", typeof(GameObject))) as GameObject; item.GetComponent<InventoryItem>().init(equipment); item.transform.localPosition = Positions.CENTER; return item; }
private void addItem(Equipment eqipment) { var newItem = InventoryItemFactory.makeItem(eqipment); newItem.transform.SetParent(itemCont); newItem.transform.localScale = Vector3.one; inventoryItems.Add(newItem.GetComponent<InventoryItem>()); }
public void dequip(Equipment item) { if (!item.equipped) { Debug.LogError("cant dequip weapon that is not equiped"); return; } int slotID = (int)item.slot; equipped[slotID].equipped = false; equipped[slotID] = null; }
public void equip(Equipment item) { if (item.equipped) { Debug.LogError("itm already equiped!"); return; } int slotID = (int)item.slot; if (equipped[slotID] != null) dequip(equipped[slotID]); equipped[slotID] = item; equipped[slotID].equipped = true; }
private void onItemHold(Equipment equipment) { itemInfo.init(equipment); }
private void onItemTap(Equipment equipment) { if (equipment.equipped) { playerModel.dequip(equipment); } else { playerModel.equip(equipment); } updateView(); }
public void updateView(Equipment equipment) { slots[(int)equipment.slot].init(equipment); }
public void dropItem(Equipment item) { inventory.Remove(item); }
private void pickUpItem(Equipment item) { inventory.Add(item); }
public void init(Equipment equipment) { this.infoText.text = equipment.description; gameObject.SetActive(true); }