Esempio n. 1
0
 public void Interact()
 {
     if (isOpen)
     {
         StopInteract();
     }
     else
     {
         AddItems();
         if (!FirstOpened)
         {
             FirstOpened = true;
             for (int i = 0; i < 4; i++)
             {
                 GoldNugget nugget = (GoldNugget)Instantiate(debugItems[0]);
                 MyBag.AddItem(nugget);
                 HealthPotion potion = (HealthPotion)Instantiate(debugItems[1]);
                 MyBag.AddItem(potion);
             }
         }
         isOpen = true;
         spriteRenderer.sprite      = openSprite;
         canvasGroup.alpha          = 1;
         canvasGroup.blocksRaycasts = true;
     }
 }
Esempio n. 2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.J))
     {
         Bag bag = (Bag)Instantiate(items[8]);
         bag.Initialize(40);
         AddItem(bag);
     }
     if (Input.GetKeyDown(KeyCode.K))//Debugging for adding a bag to the inventory
     {
         Bag bag = (Bag)Instantiate(items[8]);
         bag.Initialize(20);
         AddItem(bag);
     }
     if (Input.GetKeyDown(KeyCode.M))
     {
         HealthPotion potion = (HealthPotion)Instantiate(items[9]);
         AddItem(potion);
     }
     if (Input.GetKeyDown(KeyCode.U))
     {
         GoldNugget nugget = (GoldNugget)Instantiate(items[11]);
         AddItem(nugget);
         AddItem((HealthPotion)Instantiate(items[9]));
     }
     if (Input.GetKeyDown(KeyCode.H))
     {
         AddItem((Armor)Instantiate(items[0]));
         AddItem((Armor)Instantiate(items[1]));
         AddItem((Armor)Instantiate(items[2]));
         AddItem((Armor)Instantiate(items[3]));
         AddItem((Armor)Instantiate(items[4]));
         AddItem((Armor)Instantiate(items[5]));
         AddItem((Armor)Instantiate(items[6]));
         AddItem((Armor)Instantiate(items[7]));
         AddItem((Armor)Instantiate(items[10]));
     }
 }