private void Start() { // Display the items needed above the object. for (int i = 0; i < itemsNeeded.Count; i++) { ItemNeeded currentItem = itemsNeeded[i]; InvetoryImage invetoryImage = Instantiate(invetoryImagePrefab, itemsNeedPannel); invetoryImage.SetUp(currentItem.item.itemSprite, currentItem.amount); } repiarCanvas.enabled = false; maxScale = repairImage.transform.localScale; minScale = .8f * maxScale; }
public void OnItemsChanged() { // Destroy existing items. foreach (Transform oldItem in transform) { Destroy(oldItem.gameObject); } // Get current owned items. List <RepairItem> ownedItems = RepairItemsManager.GetAllOwnedItems(); // Add the current owned items to the inventory. foreach (RepairItem item in ownedItems) { //TODO: Add object count as well. InvetoryImage newImage = Instantiate(invetoryImagePrefab, transform); newImage.SetUp(item.itemSprite, item.count); } }