コード例 #1
0
 public void Drag(int slot, Transform con)
 {
     if (con == slotsContainer)
     {
         Vector2Int sl = inv.GetSlot(slot);
         createDrag(sl);
         inv.RemoveFromSlots(slot);
         SetItem(inv.GetSlot(slot), slotsContainer.GetChild(slot));
     }
     else if (con == toolsContainer)
     {
         Vector2Int sl = inv.GetTool(slot);
         createDrag(sl);
         inv.RemoveFromTools(slot);
         SetItem(inv.GetTool(slot), toolsContainer.GetChild(slot));
         SetItem(inv.GetTool(slot), toolsDisplay.GetChild(slot));
         SelectTool(false);
         SelectTool(true);
     }
     else if (con == activeContainer)
     {
         Vector2Int sl = inv.GetActive(slot);
         createDrag(sl);
         inv.RemoveFromActive(slot);
         SetItem(inv.GetActive(slot), activeContainer.GetChild(slot));
         AddActive(Vector2Int.zero, slot);
     }
 }
コード例 #2
0
ファイル: shop.cs プロジェクト: Beritens/AsteroidMiner
 public void sell(int slot, Transform product, item i, int count)
 {
     inv.AddMoney(i.resellValue * count);
     speechBubble.text = thx[Random.Range(0, thx.Length)];
     inv.RemoveFromSlots(slot);
     Destroy(product.gameObject);
 }