public void SetItem(Item newItem, InventoryItemController newUiItem) { item = newItem; Sprite sprite = newItem.icon; foreach (WearableController wearableController in FindObjectsOfType <WearableController>()) { wearableController.GetComponent <Selectable>().interactable = true; } foreach (var categorySlot in FindObjectsOfType <CategoryController>()) { categorySlot.GetComponent <Selectable>().interactable = true; } _itemIcon.sprite = sprite; GetComponent <Selectable>().Select(); ChangingItem = null; FindObjectOfType <WeightBarController>().UpdateBar(); if (uiItem != null) { uiItem.SetNotInUse(); } uiItem = newUiItem; newUiItem.SetInUse(); //_defaultSprite = image.sprite; _image.sprite = _defaultSprite; }
public void ClearItem() { uiItem?.SetNotInUse(); _itemIcon.sprite = _blankSprite; item = null; uiItem = null; FindObjectOfType <WeightBarController>().UpdateBar(); }