private void AddItemToInventory(AiController controller, Item item) { if (holdingItems.ContainsKey(item.baseObjectInfo.Id) || (currentWeight + item.itemTypeData.itemData.itemWeight) > weightLimit) { return; } holdingItems.Add(item.baseObjectInfo.Id, item); currentWeight += item.itemTypeData.itemData.itemWeight; SetItemTransform(item, inventoryHolder.transform, new Vector3(0, 0, 0), false); EventRelay.OnInventoryUpdated(controller); }
private void DropInventoryItem(AiController controller, Item item) { if (!holdingItems.ContainsKey(item.baseObjectInfo.Id)) { return; } holdingItems.Remove(item.baseObjectInfo.Id); currentWeight -= item.itemTypeData.itemData.itemWeight; SetItemTransform(item, null, item.usedBy.transform.position + new Vector3(0, 1.4f, 0), true); item.GetComponent <Rigidbody>().AddForce(transform.forward + new Vector3(0, 1, 0) * 2, ForceMode.VelocityChange); //EventRelay.OnItemDropped(controller, item); EventRelay.OnInventoryUpdated(controller); }