public void ShowShopUI(ShopTrigger st, List <ShopItem> shopItems, string shopName) { trigger = st; shopUI.SetActive(true); shopEnabled = true; Time.timeScale = 0; shopUI.transform.Find("ShopName").gameObject.GetComponent <TextMeshProUGUI>().text = shopName; foreach (ShopItem si in shopItems) { GameObject itemPrefabInstantiated = Instantiate(itemPrefab); currentObjectsOnDisplay.Add(itemPrefabInstantiated); itemPrefabInstantiated.GetComponent <HoverManager>().GetStats(this, si); itemPrefabInstantiated.GetComponent <Button>().onClick.AddListener(() => PurchaseItem(itemPrefabInstantiated, si)); itemPrefabInstantiated.transform.SetParent(shopUI.transform.Find("Grid")); itemPrefabInstantiated.transform.Find("Preview").gameObject.GetComponent <Image>().sprite = si.itemImage; } }
void Awaik() { instance = this; }