public void InteractAttempt(ItemHandler handler) { closestInteraction = UpdateInteractibles(); if (closestInteraction == null) { InteractionsInRange = new List <GameObject>(); return; } else { if (closestInteraction.CanAct() == false) { return; } //closestInteraction.LeaveRange(this); if (handler.currentItem != null && closestInteraction.CanReceiveItem()) { InteractWithItem(closestInteraction, handler); OnUseItem.Invoke(handler.currentItem); } else { InteractWithoutItem(closestInteraction); } } }
private void OnItemUsed(Item item) { if (this.item == item) { itemUsedInstancedEvent.Invoke(item); } else { Debug.Log("Wrong item."); } }
internal static void InvokeUseItemEvent(Player player, ItemType item, out bool allow) { allow = true; if (UseItemEvent == null) { return; } var ev = new UseItemEvent { Player = player, Item = item, Allow = true }; UseItemEvent.Invoke(ev); allow = ev.Allow; }
public void Use() { if (item != null) { if (InventoryManager.Instance.HasItem(item) || !requireItem) { UseItemComponent.itemUsedEvent.Invoke(item); itemUsedInstanceEvent.Invoke(item); InventoryManager.Instance.RemoveItem(item); } else { Debug.LogError("Cant use no item."); } } else { Debug.LogError("No item assigned"); } }
public void OnClickItem(EzItemSet itemSet) { onUseItem.Invoke(itemSet, 1); }