﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class UIGarbageSlot : UIInventorySlot
{
    /// <summary>
    /// Override the OnDrop event
    /// </summary>
    /// <param name="eventData"></param>
    public override void OnDrop(PointerEventData eventData)
    {
        //If we already have an item, destroy it and accept the new item.  Effectively emptying the trash.
        //Additionally don't let us empty the trash by dropping back onto ourselves.
        if (item != null && eventData.pointerDrag != gameObject)
        {
            Destroy(item);
            item = null;
        }

        base.OnDrop(eventData);
    }
}
