public bool HasGroup(GroupData group)
 {
     if (data != null)
     {
         return(data.HasGroup(group) || selectable.HasGroup(group));
     }
     return(selectable.HasGroup(group));
 }
예제 #2
0
 //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);
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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));
 }
예제 #6
0
 public bool HasGroup(GroupData group)
 {
     return(data.HasGroup(group) || selectable.HasGroup(group));
 }