You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
709 B

  1. using System.Linq;
  2. using UnityEngine;
  3. public class InventoryCatch : LogicElementHolder
  4. {
  5. [SerializeField]
  6. private InventoryUI InventoryUI;
  7. public override void OnAdd(LogicElementUI element)
  8. {
  9. foreach (LogicBlock block in element.logicElement.GetAllBlocks())
  10. {
  11. BagItem item = InventoryUI.content.FirstOrDefault(p => p.canHold(block));
  12. if (item != default)
  13. item.OnAdd(element);
  14. Destroy(element.gameObject);
  15. }
  16. }
  17. public override void OnDoubleClick(LogicElementUI element)
  18. {
  19. //DoNothing
  20. }
  21. public override void OnRemove(LogicElementUI element)
  22. {
  23. //DoNothing
  24. }
  25. }