// Inspect an item. private void UseInspector(Slot slot) { // Can't select the same item twice, or select 2 items at once. // This doesn't work 100% if you abuse it (spam click), but it does for the most part, and always resets anyway. if (currentSelection == slot) { HideInspector(); return; } else if (currentSelection && GameManager.Instance.TutorialIntroComplete) { HideInspector(); } // To avoid null errors, always use the x.Get() methods, they check for you. Item item; ItemInstance instance; if (slot.GetItemInstance(out instance) && slot.GetItem(out item)) { if (item.GetType() == typeof(ResourceBag)) { ResourcePouchOpen(slot); } else { Slot previousSelection = currentSelection; currentSelection = slot; inspectionPanel.SetActive(true); SFX.Play("Mag_item_select", 1f, 1f, 0f, false, 0f); textHeading.text = instance.itemName; textInfo.text = instance.itemInfo; MoveUp(slot); if (!GameManager.Instance.TutorialGolemMade) { GameObject obj; if (slot.GetPrefabInstance(out obj)) { tutorialManager.DestroySpecificItemIndicator(obj); } } if (!GameManager.Instance.TutorialIntroComplete && currentSelection != previousSelection && previousSelection != null) { MoveDown(currentSelection); MoveDown(previousSelection); HideInspector(); } } } else { HideInspector(); } }