private void UpdateStatus() { //Бумеранг: image.sprite = Resources.Load <Sprite>(string.Format(@"Sprites/Skins/{0}/inventory_image", data.id)); hpText.text = string.Format("{0}", data.hp); freezeText.text = string.Format("{0:F1}", data.freeze); //Кнопки: if (data.isActive) { var isCurrent = data.id == GameManager.Instance.inventoryData.activeBoomerang; if (isCurrent) { current = this; } currBoomerang.SetActive(isCurrent); btnSelect.SetActive(!isCurrent); btnBuy.SetActive(false); btnWait.SetActive(false); } else { currBoomerang.SetActive(false); btnSelect.SetActive(false); imgAds.SetActive(data.resource == ConstantsResource.ADS); imgMoney.SetActive(data.resource == ConstantsResource.MONEY); switch (data.resource) { case ConstantsResource.MONEY: SetVisibleAdsAndIapButton(true); priceText.text = string.Format("{0}", data.price); break; case ConstantsResource.ADS: priceText.text = ""; SetVisibleAdsAndIapButton(true); break; case ConstantsResource.IAP: if (IapManager.Instance.IsInitialized()) { UpdateIapPrice(); } else { SetVisibleAdsAndIapButton(false); } break; } } }
// Use this for initialization void Start() { itemInv = this.GetComponent <ItemInventoryController>(); List <Transform> respawnPoss = new List <Transform>(); respawnPoss = GameObject.FindGameObjectsWithTag("RespawnPoint") .Select(s => s.transform) .ToList(); for (int i = 0; i < itemNum; i++) { GameObject item = RespawnItem((ItemInventoryController.ITEM)i); item.transform.position = respawnPoss[Random.Range(0, respawnPoss.Count)].position; } }
// Use this for initialization void Start() { itemInv = GameObject.FindWithTag("GameController").GetComponent <ItemInventoryController>(); // アイテムプレファブのロード for (int i = 0; i < itemInv.itemLength; i++) { GameObject item = LoadItem((ItemInventoryController.ITEM)i); itemPrefabs.Add(item); item.SetActive(false); this.UpdateAsObservable() .Subscribe(_ => item.transform.SetPositionAndRotation(itemHand.position, this.transform.rotation)) .AddTo(this.gameObject); } nowItem.Subscribe(x => { itemPrefabs[(int)x].SetActive(true); itemPrefabs[(int)backItem].SetActive(false); }); }