//When the character interact with this selectable, check all the actions and see if any should be triggered.
        public void Use(PlayerCharacter character, Vector3 pos)
        {
            if (enabled)
            {
                PlayerUI ui   = PlayerUI.Get(character.player_id);
                ItemSlot slot = ui != null?ui.GetSelectedSlot() : null;

                MAction maction = slot != null && slot.GetItem() != null?slot.GetItem().FindMergeAction(this) : null;

                AAction aaction = FindAutoAction(character);
                if (maction != null && maction.CanDoAction(character, slot, this))
                {
                    maction.DoAction(character, slot, this);
                    PlayerUI.Get(character.player_id)?.CancelSelection();
                }
                else if (aaction != null && aaction.CanDoAction(character, this))
                {
                    aaction.DoAction(character, this);
                }
                else if (actions.Length > 0)
                {
                    ActionSelector.Get(character.player_id)?.Show(character, this, pos);
                }

                if (onUse != null)
                {
                    onUse.Invoke(character);
                }
            }
        }
 public AAction FindAutoAction(PlayerCharacter character)
 {
     foreach (SAction action in actions)
     {
         if (action is AAction)
         {
             AAction aaction = (AAction)action;
             if (aaction.CanDoAction(character, this))
             {
                 return(aaction);
             }
         }
     }
     return(null);
 }