// Start is called before the first frame update void Start() { pickup_ = GetComponent <Pickup>(); pickup_.onPick += OnPicked; pickupItemUI_ = GameObject.FindGameObjectWithTag(Constants.TagName.GAME_CONTROLLER).GetComponent <PickupItemUI>(); }
// Once an item is clicked in the menu, decide whether it is a tool, weapon, clothing, or armor to Equip, // or if its consumable to Use.. public void SetSelectedPickupInInv(PickupItemUI pickup) { curSelctedPickupInInv = pickup; ePickupType pickupType = pickup.itemInstanceRef.item.pickupType; if (pickupType == ePickupType.ToolsAndWeapons || pickupType == ePickupType.ClothingAndArmor) { equipText.SetActive(true); canEquipSelectedItem = true; useText.SetActive(false); canUseSelectedItem = false; } else if (pickupType == ePickupType.Consumables) { equipText.SetActive(true); canEquipSelectedItem = true; useText.SetActive(true); canUseSelectedItem = true; } else { equipText.SetActive(false); canEquipSelectedItem = false; useText.SetActive(false); canUseSelectedItem = false; } }
public void AddContent(ItemInstance item, InventoryUI inventoryUIRef) { GameObject newUIItem = Instantiate(pickupItemUI); PickupItemUI itemUI = newUIItem.GetComponent <PickupItemUI>(); itemUI.SetupItem(item.item.itemName, item.item.icon, 1, item.item.weight, item.item.value, inventoryUIRef, item); newUIItem.transform.SetParent(contentPanel.transform, true); }
public void Clicked() { isSelected = true; PickupItemUI lastItem = inventoryUIRef.GetPickupItemUI(); if (lastItem != null && lastItem != this) { lastItem.SelectItem(false); lastItem.isSelected = false; } SelectItem(true); inventoryUIRef.SetSelectedPickupInInv(this); inventoryUIRef.SetClickItemInfo(itemInstanceRef); }
// Use this for initialization void Start() { ui = GameObject.FindGameObjectWithTag("UI").GetComponent <PickupItemUI>(); }