Example #1
0
    public void IteractWithSlot()
    {
        Cursor_scr Cursor = GameObject.Find("Cursor").GetComponent <Cursor_scr>();

        if (CanCraft)
        {
            GameObject Inventory = GameObject.Find("InventoryManager");
            if (!Cursor.HandContainerFull)
            {
                //Debug.Log(CraftItem);
                Cursor.CursorContainerActivation(CraftItem, CraftItemCount);


                if (InventoryComponent == null)
                {
                    InventoryComponent = Inventory.GetComponent <Inventory_scr>();
                }
                InventoryComponent.TakeItem(CraftItemComponent);
            }
            else if (Cursor.HandContainer == CraftItemComponent.id)
            {
                Cursor.CursorContainerActivation(CraftItemCount);
                InventoryComponent.TakeItem(CraftItemComponent);
            }
            InventoryComponent.CraftSlotsCheker();
        }
        else
        {
            GameObject.Find("NewDropPanel").GetComponent <LeftUpShowPanel_scr>().CheckRecepy(CraftItem);
            Debug.Log("Для сотворения чего-то  не хватает");
        }
    }
Example #2
0
 public void TakeItem(int slot)
 {
     GameObject[]    Items  = null;
     int[]           Counts = null;
     InventorySlot[] Slots  = null;
     if (slot < 50)
     {
         Items  = InvItems;
         Counts = ItemsCount;
         Slots  = InvSlots;
     }
     else if (slot < 60)
     {
         Items  = CraftItems;
         Counts = CraftCounts;
         Slots  = CraftSlots;
         //CraftSlotsCheker();
         slot -= 50;
     }
     if (Items[slot] != null && IVTR.activeSelf == true)
     {
         CursorComponent.CursorContainerActivation(Items[slot], Counts[slot]);
         //SmthInHand = true;
         Slots[slot].SlotActivation(false);
         Counts[slot] = 0;
         Items[slot]  = null;
         UpdateInventory();
         ChangeInHandItem();
         if (CraftTab.activeSelf)
         {
             CraftSlotsCheker();
         }
     }
 }
Example #3
0
    public void IteractWithSlot()
    {
        Debug.Log("Click");
        if (CursorComponent.HandContainerFull) // если в руках есть some
        {
            int        id       = CursorComponent.HandContainer;
            GameObject FreeHand = DropCatalog.GetGObyID(id);
            Drop_scr   drop     = FreeHand.GetComponent <Drop_scr>();
            Debug.Log(drop.type.Equals(SlotType));
            if (drop.type.Equals(SlotType))
            {
                if (busy) //клетка занята
                {
                    SlotBenifits(-1);
                    CursorComponent.CursorContainerActivation(inSlot, 1);
                    SetSlot(FreeHand);
                    SlotBenifits(1);
                    //
                }
                else //положить в пустую
                {
                    SetSlot(FreeHand);
                    SlotBenifits(1);
                    CursorComponent.CursorContainerActivation();
                }
            }
            else
            {
                Debug.Log("Этот предмет не подходит в этот слот");
            }

            // InventoryComponent.PutItem(SlotNumber);
        }
        else if (busy) // руки пустые, но в клетке предмет
        {
            CursorComponent.CursorContainerActivation(inSlot, 1);
            SlotBenifits(-1);
            SetSlot();
        }
    }
Example #4
0
 public void DeleteInHand()
 {
     Cursor.CursorContainerActivation();
 }