Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     shopGlobal      = GameObject.FindGameObjectWithTag("ShopGlobal").GetComponent <ShopGlobalScrip>();
     database        = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent <ItemDatabase>();
     description     = GameObject.FindGameObjectWithTag("Description");
     descriptionText = description.transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).transform.GetChild(0).GetComponent <Text>();
     buyButton       = description.transform.GetChild(2).GetComponent <Button>();
     buyButton.onClick.AddListener(buyProduct);
     graineButton.onClick.AddListener(graineCategorie);
     mobilierButton.onClick.AddListener(mobilierCategorie);
     quickBar      = GameObject.FindGameObjectWithTag("QuickBar").GetComponent <QuickBar>();
     marchande     = GameObject.FindGameObjectWithTag("ShopGlobal").GetComponent <MarchandeScript>();
     boolMarchande = false;
     categorie     = Item.ItemType.Graine;
     slotamount    = 0;
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 6; j++)
         {
             GameObject slot = (GameObject)Instantiate(slots);
             slot.GetComponent <SlotShopScript>().slotNumber = slotamount;
             Slots.Add(slot);
             Items.Add(new Item());
             slot.name = "Slot" + i + "." + j;
             slot.transform.SetParent(this.gameObject.transform);
             slotamount++;
         }
     }
     graineCategorie();
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     quickBar      = GameObject.FindGameObjectWithTag("QuickBar").GetComponent <QuickBar>();
     itemPanel     = transform.GetChild(1).gameObject;
     quantitePanel = transform.GetChild(2).gameObject;
     prixPanel     = transform.GetChild(3).transform.GetChild(0).gameObject.GetComponent <Text>();
     vendreButton  = transform.GetChild(4).GetComponent <Button>();
     vendreButton.onClick.AddListener(vendreProduct);
     plusButton = quantitePanel.transform.GetChild(0).GetComponent <Button>();
     plusButton.onClick.AddListener(plusQuantite);
     moinsButton = quantitePanel.transform.GetChild(1).GetComponent <Button>();
     moinsButton.onClick.AddListener(moinsQuantite);
     shopGlobal    = GameObject.FindGameObjectWithTag("ShopGlobal").GetComponent <ShopGlobalScrip>();
     marchande     = GameObject.FindGameObjectWithTag("ShopGlobal").GetComponent <MarchandeScript>();
     item          = new Item();
     nbProductSell = 0;
 }