public AttackByEventArgs(IEntity target, IEntity user, IItemComponent item, string handIndex) { Target = target; User = user; Item = item; HandIndex = handIndex; }
public override void DoAction(ItemData item) { try { IItemComponent itemComponent = item.gameObject.GetComponent(typeof(IItemComponent)) as IItemComponent; itemComponent.UseItem(item); } catch (Exception ex) { Debug.LogError("No IItemComponent was attached to item data object, unable to call use item function"); } }
public bool Insert(string slot, IItemComponent item) { if (item == null) { throw new ArgumentNullException(nameof(item), "An item must be passed. To remove an item from a slot, use Drop()"); } var inventorySlot = _GetSlot(slot); if (!CanInsert(slot, item) || !container.Insert(item.Owner)) { return(false); } inventorySlot.Item = item; item.EquippedToSlot(inventorySlot); return(true); }
public void RemoveChild(IItemComponent itemComponent) { childList.Remove(itemComponent); }
public void AddChild(IItemComponent itemComponent) { childList.Add(itemComponent); }
public bool CanInsert(string slot, IItemComponent item) { var inventorySlot = _GetSlot(slot); return(inventorySlot.Item == null && container.CanInsert(item.Owner)); }