public void UpdateObservers(IShopMode mode) { if (mode.GetType() == typeof(HatShopMode)) { currentmode = hatShopMode; } if (mode.GetType() == typeof(BodyShopMode)) { currentmode = bodyShopMode; } items1 = currentmode.GetItems(); itemsObjects = new GameObject[items1.Length]; for (int i = 0; i < items1.Length; i++) { itemsObjects[i] = items1[i].GetObject(); } DeleteScrollList(); DrawScrollList(); SpawnItemsOnScroll(); }
private void Update() { isChanged = CheckChangesItem(); if (isChanged) { if (!isSpawned) { spawnItem = Instantiate(currentModeItems[itemId].GetObject()); spawnItem.transform.position = shopMode.GetAttachedPosition(); if (shopMode.GetType() == typeof(HatShopMode)) { spawnItem.transform.localScale = new Vector2(1.5f, 1.5f); spawnItem.transform.position = new Vector2(spawnItem.transform.position.x + 0.1f, spawnItem.transform.position.y + 0.2f); if (currentModeItems[itemId].GetName() == "New Year Hat") { spawnItem.transform.position = new Vector2(spawnItem.transform.position.x + 0.1f, spawnItem.transform.position.y + 0.4f); } } costText.text = currentModeItems[itemId].GetCost().ToString(); } } }