Пример #1
0
        public void SetUIItem(Item item, int amount)
        {
            if (uiItem != null)
            {
                Destroy(uiItem.gameObject);
            }

            if (item == null)
            {
                return;
            }

            GameObject instance = Instantiate(uiItemPrefab, transform);

            instance.transform.position = new Vector3(instance.transform.position.x, instance.transform.position.y, 1);
            uiItem = instance.GetComponent <UIItem>();

            uiItem.SetAmount(amount);

            uiItem.Icon.sprite = item.Icon;
        }
Пример #2
0
 private void Awake()
 {
     uiItem = GetComponentInChildren <UIItem>();
 }