34 lines
893 B
C#
34 lines
893 B
C#
![]() |
using UnityEngine;
|
|||
|
using UnityEngine.EventSystems;
|
|||
|
using Image = UnityEngine.UI.Image;
|
|||
|
|
|||
|
public class ItemSlotBehavior : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
|
|||
|
{
|
|||
|
public static GameObject DraggedInstance;
|
|||
|
public Inventory inventory;
|
|||
|
|
|||
|
Vector3 _startPosition;
|
|||
|
Vector3 _offsetToMouse;
|
|||
|
float _zDistanceToCamera;
|
|||
|
|
|||
|
#region Interface Implementations
|
|||
|
|
|||
|
public void OnBeginDrag (PointerEventData eventData)
|
|||
|
{
|
|||
|
DraggedInstance = gameObject;
|
|||
|
Debug.Log ("Removing: " + DraggedInstance.GetComponent<Image> ().sprite.name.Remove (DraggedInstance.GetComponent<Image> ().sprite.name.Length - 7));
|
|||
|
inventory.RemoveItem(DraggedInstance.GetComponent<Image>().sprite.name.Remove(DraggedInstance.GetComponent<Image>().sprite.name.Length-7));
|
|||
|
}
|
|||
|
|
|||
|
public void OnDrag (PointerEventData eventData)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void OnEndDrag (PointerEventData eventData)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|