public void discartSelectedItem() //Item Specification Window { UIItemFish itemFish = UIGameManager.instance.selectedFish; ItemManager.instance.deleteItemFish(itemFish.itemFish.id); transform.parent.gameObject.SetActive(false); Destroy(itemFish.gameObject); UIGameManager.instance.selectedFish = null; }
public int sellItemFish(UIItemFish itemFish) { int value; value = (int)(itemFish.itemFish.weight * itemFish.itemFish.fishItemData.valuePerLb); deleteItemFish(itemFish.itemFish.id); Destroy(itemFish.gameObject); return(value); }
// If necessary, create an array instead of a lot of variables for the animations void Start() { itemFishScript = GetComponent <UIItemFish>(); fishSprite = GameManager.instance.GetFishDataById(itemFishScript.itemFish.fishItemData.id).fishSprite; imageComponent = GetComponent <Image>(); //Our image component is the one attached to this gameObject. InvokeRepeating("changeSprite", 0, 0.4F); counter = 0; animationDelay = 0.4f; }
// Use this for initialization void Start() { selectedFish = UIGameManager.instance.selectedFish; selectedFishData = ItemManager.instance.GetItemFishDataById(selectedFish.itemFish.baseId); tm = TranslatorManager.instance; itemName.text = tm.GetTranslationById("fish_name_" + selectedFishData.id); //selectedFishData.fishName; itemLength.text = selectedFish.itemFish.length.ToString() + " " + tm.GetTranslationById("measurement_inches"); itemWeight.text = selectedFish.itemFish.weight.ToString() + " " + tm.GetTranslationById("measurement_pounds"); itemRarity.text = tm.GetTranslationById("rarity_" + selectedFishData.rarity); itemImage.sprite = selectedFishData.fishPortraitImage; itemImage.preserveAspect = true; imageHeight = selectedFish.transform.parent.gameObject.GetComponent <RectTransform>().rect.height; transform.position = new Vector3(selectedFish.transform.position.x, selectedFish.transform.position.y + (Screen.height / 100) * 5, 0); }
private void quickSingleItemSell() { selectedFish = UIGameManager.instance.selectedFish; if (selectedFish != null) { UIGameManager.instance.closeItemSpecificationWindow(); GameManager.instance.player.currentGold += ItemManager.instance.sellItemFish(selectedFish); UIGameManager.instance.updateCurrentGold(); GameObject hudCoinEffect = (GameObject)Instantiate(Resources.Load("Prefabs/Particles/HUD Coin Effect"), Vector2.zero, Quaternion.identity); hudCoinEffect.transform.SetParent(UIGameManager.instance.goldPanel.goldIcon.transform, false); // set where it will be in the hierarchy //GameObject particle = (GameObject)Instantiate(Resources.Load("Prefabs/Particles/Coin From To"), GameManager.instance.merchantNear.transform.position, Quaternion.identity); //particle.GetComponent<ParticleAttractor>().origin = GameManager.instance.merchantNear.transform; //particle.GetComponent<ParticleAttractor>().destiny = GameManager.instance.playerMovement.transform; //particle.GetComponent<ParticleSystem>().trigger.SetCollider(0, GameManager.instance.playerMovement.transform); } }