Пример #1
0
 private void UseItem(int index)
 {
     if (itemsPlacementWear.Count > index && itemsPlacementWear.ElementAt(index).Value.Count > 0)
     {
         Inventory.ItemPickup i = itemsPlacementWear.ElementAt(index).Value[itemsPlacementWear.ElementAt(index).Value.Count - 1].GetComponent <Inventory.ItemPickup>();
         i.item.Use(index);
     }
 }
Пример #2
0
 private bool AddItem(Inventory.ItemPickup ip, ItemInInventory ii)
 {
     if (ip.item != null && ip.item.itemWeight <= ii.placementWear)
     {
         ii.placementWear = -ip.item.itemWeight;
         return(true);
     }
     return(false);
 }
Пример #3
0
 private bool AddItem(Inventory.ItemPickup ip, ItemInInventory ii, out GameObject ipAddPlaceList, out GameObject parentPlace)
 {
     if (ip.item.itemWeight <= ii.placementWear)
     {
         ii.placementWear = -ip.item.itemWeight;
         ipAddPlaceList   = ip.gameObject;
         parentPlace      = ii.placement;
         return(true);
     }
     ipAddPlaceList = null;
     parentPlace    = null;
     return(false);
 }
Пример #4
0
    private bool FindPlaceItem(Inventory.ItemPickup ite, out GameObject goPlacement)
    {
        GameObject ob;

        foreach (KeyValuePair <ItemInInventory, List <GameObject> > ipw in itemsPlacementWear)
        {
            if (AddItem(ite, ipw.Key, out ob, out goPlacement))
            {
                ipw.Value.Add(ob);
                return(true);
            }
        }
        goPlacement = null;
        return(false);
    }
Пример #5
0
    private void CheckRaycastHitItem(out GameObject hitG, out Inventory.ItemPickup hitItem)
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, pickRadius, itemLayer) && hit.collider.gameObject.GetComponent <Inventory.ItemPickup>() != null)
        {
            hitG    = hit.collider.gameObject;
            hitItem = hitG.GetComponent <Inventory.ItemPickup>();
            if (hitItem.item != null)
            {
                textPickup.enabled = true;
                textPickup.text    = pickupText.Replace("<NAME>", hitItem.item.itemName.ToUpper());
            }
        }
        else
        {
            textPickup.enabled = false;
            hitG    = null;
            hitItem = null;
        }
    }