public void setNewItemSlot(int actualItemID) { listItemScript = GameObject.Find("ListItem").GetComponent <listItemScript>(); player = GameObject.Find("Player").GetComponent <Player>(); this.actualItemID = actualItemID; transform.GetChild(0).GetComponent <Image>().sprite = listItemScript.getListSortedItem()[actualItemID].GetComponent <SpriteRenderer>().sprite; }
public void setNewSlotShop(int itemID) { this.itemID = itemID; player = GameObject.Find("Player").GetComponent <Player>(); listItemScript = GameObject.Find("ListItem").GetComponent <listItemScript>(); transform.GetChild(0).GetComponent <Image>().sprite = listItemScript.getListSortedItem()[itemID].GetComponent <SpriteRenderer>().sprite; }
public void chooseItemShop() { listItemScript = GameObject.Find("ListItem").GetComponent <listItemScript>(); player = GameObject.Find("Player").GetComponent <Player>(); if (GameObject.Find("Canvas").GetComponent <ControlMenu>().getShopOpen()) { //If the slot who we click have an item if (player.listSlotItem.Contains(transform.GetSiblingIndex())) { GameObject.Find("Canvas").GetComponent <ControlMenu>().getActualSlotShop().GetComponent <slotShopScript>().setNewSlotShop(actualItemID); //Active the amount menu transform.parent.parent.parent.parent.GetChild(1).gameObject.SetActive(true); GameObject.Find("AmountText").GetComponent <amountShopScript>().amoutNumber = 1; GameObject.Find("AmountText").GetComponent <amountShopScript>().setTextAmount(); } else { transform.parent.parent.parent.parent.GetChild(1).gameObject.SetActive(false); } //transform.parent.parent.parent.parent.GetChild(1).gameObject.SetActive(false); //transform.parent.parent.parent.gameObject.SetActive(false); } }
void Start() { player = GameObject.Find("Player").GetComponent <Player>(); listItem = GameObject.Find("ListItem").GetComponent <listItemScript>(); SetSlot(); }
void Start() { listItemScript = GameObject.Find("ListItem").GetComponent <listItemScript>(); player = GameObject.Find("Player").GetComponent <Player>(); }