public void RemoveItem(Item_Base item) { Debug.Log($"Removing item. Name : '{item.ItemName}'"); itemList.Remove(item); Object.Destroy(item); }
public void AddItem(Item_Base item) { itemList.Add(item); item.SetItemOwner(this); Debug.Log($"Item added. Name : '{item.ItemName}'"); }
public static void ResetCameraPositionAndRotation(Item_Base item, Transform itemTransform) { SetOrthoSize(DEFAULT_PREVIEW_CAMERA_ORTHO_SIZE); SetPosition(itemTransform.position - new Vector3(0, 0, 1)); SetRotation(Quaternion.identity); if (item is Item_Weapon) { var weapon = item as Item_Weapon; SetOrthoSize(weapon.CustomOrthoSize); SetPosition(GetPosition() + weapon.MenuCameraOffset); SetRotation(Quaternion.Euler(weapon.MenuDefaultCameraRotation)); } }
public void Init(Item_Base item) { Item = item; if (Background != null && Ring != null && ItemRenderer != null) { return; } // =============================================================================================== // Local variable declaration // =============================================================================================== var iconSize = 128; var ringSize = 120; var rawImageSize = 100; var renderTextureSize = 175; // =============================================================================================== // Create Background // =============================================================================================== var backgroundImg = UI_Pool.Instance.GetImage(RectTransform, iconSize, iconSize, nameof(Background)); backgroundImg.rectTransform.localPosition = Vector2.zero; backgroundImg.raycastTarget = false; Background = backgroundImg.gameObject.AddComponent <UI_Menu_Inventory_Left_ItemIcon_Background>(); // =============================================================================================== // Create Ring // =============================================================================================== var ringImg = UI_Pool.Instance.GetImage(RectTransform, ringSize, ringSize, nameof(Ring)); ringImg.rectTransform.localPosition = Vector2.zero; ringImg.sprite = UI_Menu.Instance.MenuResources.InventoryItemIconRing_Sprite; ringImg.raycastTarget = false; Ring = ringImg.gameObject.AddComponent <UI_Menu_Inventory_Left_ItemIcon_Ring>(); // =============================================================================================== // Create RawTexture to render the item // =============================================================================================== var itemImage = UI_Pool.Instance.GetRawImage(RectTransform, rawImageSize, rawImageSize, nameof(ItemRenderer)); itemImage.rectTransform.localPosition = Vector2.zero; itemImage.color = Color.white; itemImage.raycastTarget = true; itemImage.texture = new RenderTexture(renderTextureSize, renderTextureSize, 16, RenderTextureFormat.ARGBHalf); ItemRenderer = itemImage.gameObject.AddComponent <UI_Menu_Inventory_Left_ItemIcon_Renderer>(); }
public static Item_Product CreateProduct(Item_Base itemBase) { return(new Item_Product(itemBase, 50, 1)); }
public Item_Product(Item_Base product, int customPrice, int stock) { this.product = product; this.customPrice = customPrice; this.stock = stock; }
public void Activate(Item_Base item) { OnBecomeActiveEvent.Invoke(); gameObject.SetActive(true); SetItemDetails(item.ItemDetails); }
public static Item_Preview InstantiateItemPrefab(Item_Base itemBase, in Vector2 positionOffset)