public void TryUseItem(inventoryItem item, clickableObject co) { foreach (var useEvent in item.useEvents) { //print(useEvent.target.gameObject.name); if (useEvent.target == co) { print("Used " + item.gameObject.name + " on " + co.gameObject.name); useEvent.reaction.Invoke(); pItems.Remove(selected.gameObject); UseText.text = ""; dragIcon.SetActive(false); Cursor.visible = true; return; } } dragIcon.SetActive(false); Cursor.visible = true; UseText.text = "Nothing happens."; print("Nothing happens."); }
void OpenClickableCanvas(clickableObject c) { selected = c; description.text = c.objDescription; UIelements.SetActive(true); //UIelements.transform.position = selected.transform.position; InventoryElements.SetActive(false); canv.enabled = true; if (c.useActionAvailable) { Button.SetActive(true); } else { Button.SetActive(false); } if (c.lookActionAvailable) { Button1.SetActive(true); } else { Button1.SetActive(false); } if (c.takeActionAvailable) { Button2.SetActive(true); } else { Button2.SetActive(false); } descBG.SetActive(true); Button3.SetActive(false); LetterImage.SetActive(false); LookImage.SetActive(false); HapImage.SetActive(false); }