InventorySlot.cs 609 B

123456789101112131415161718192021222324
  1. using Assets.HeroEditor4D.InventorySystem.Scripts.Elements;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.EventSystems;
  7. public class InventorySlot : MonoBehaviour , IDropHandler
  8. {
  9. public void OnDrop(PointerEventData eventData){
  10. if(transform.childCount == 0){
  11. ItemInventory inventoryItemm = eventData.pointerDrag.GetComponent<ItemInventory>();
  12. inventoryItemm.parentAfterDrag = transform;
  13. }
  14. }
  15. public void Clear()
  16. {
  17. GetComponentInChildren<ItemInventory>().Clear();
  18. }
  19. }