public bool HasGroup(GroupData group) { if (data != null) { return(data.HasGroup(group) || selectable.HasGroup(group)); } return(selectable.HasGroup(group)); }
//Merge action public override void DoAction(PlayerCharacter character, ItemSlot slot, Selectable select) { if (select.HasGroup(merge_target)) { InventoryData inventory = slot.GetInventory(); inventory.RemoveItemAt(slot.index, 1); character.Inventory.GainItem(inventory, filled_item, 1); } }
public override void DoAction(PlayerCharacter character, ItemSlot slot, Selectable select) { if (select.HasGroup(merge_target)) { ItemProvider provider = select.GetComponent <ItemProvider>(); InventoryData inventory = slot.GetInventory(); provider.RemoveItem(); provider.PlayTakeSound(); inventory.RemoveItemAt(slot.index, 1); character.Inventory.GainItem(inventory, filled_item, 1); } }
public MAction FindMergeAction(Selectable other) { if (other == null) { return(null); } foreach (SAction action in actions) { if (action != null && action is MAction) { MAction maction = (MAction)action; if (other.HasGroup(maction.merge_target)) { return(maction); } } } return(null); }
//Condition when mergin item-select, override if you need to add a new condition public virtual bool CanDoAction(PlayerCharacter character, ItemSlot slot, Selectable select) { return(select != null && select.HasGroup(merge_target)); }
public bool HasGroup(GroupData group) { return(data.HasGroup(group) || selectable.HasGroup(group)); }