Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5.  
  6. public class Slot : MonoBehaviour, IDropHandler {
  7.  
  8. //public GameObject item
  9. //{
  10. // get
  11. // {
  12. // if (transform.childCount > 0)
  13. // {
  14. // return transform.GetChild(0).gameObject;
  15. // }
  16. // return null;
  17. // }
  18. //}
  19.  
  20. [SerializeField] GameObject item1;
  21.  
  22. public void OnDrop(PointerEventData eventData)
  23. {
  24. if (!item1)
  25. {
  26.  
  27. DragHandeler.itemBeingDragged.transform.SetParent(transform);
  28. }
  29. }
  30.  
  31.  
  32. // Update is called once per frame
  33. void Update () {
  34. if (transform.childCount > 0)
  35. {
  36. Transform tempTransform = transform.GetChild(0);
  37. item1 = tempTransform.gameObject;
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement