/** * Set the context to inventory * * Arguments * - Item item - The item selected */ public void SetContextToInventory(Item item) { if (currentContext != Context.INVENTORY) currentContext = Context.INVENTORY; InventoryContextPanel[0].SetActive(true); // First, set the inventory context panel to active attachedObject = item; // Next attach item /* Next, set the text */ if (attachedObject == null) { // No item given InventoryContextPanel[1].GetComponent<Text>().text = "No Item In Slot" + StringMethodsScript.NEWLINE; /* Change text position */ InventoryContextPanel[1].GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f); /* Set buttons to be inactive */ InventoryContextPanel[2].SetActive(false); InventoryContextPanel[3].SetActive(false); } else { // Item given. Set everything to be active InventoryContextPanel[1].GetComponent<Text>().text = attachedObject.ToString(); InventoryContextPanel[1].GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f); /* Set buttons to be active, but if not activatable, don't activate the "Activate" button */ InventoryContextPanel[2].SetActive(item.IsActivatable()); InventoryContextPanel[3].SetActive(item.IsDroppable()); } }