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); } }
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); }
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); }
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); }
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; } }