/// <summary>
        /// When the player stops dragging an object
        /// </summary>
        public void ItemOnEndDrag()
        {
            // Hide the panel
            if (currentPanel != null)
            {
                currentPanel.gameObject.SetActive(false);
            }

            // Reset
            fromObject    = null;
            fromContainer = -1;
            fromIndices   = null;
            currentPanel  = null;
        }
Example #2
0
        /// <summary>
        /// When the player stops dragging an object
        /// </summary>
        public void ItemOnEndDrag()
        {
            // Hide the panel
            if (currentPanel != null)
            {
                currentPanel.Hide();
            }

            // Reset
            fromObject    = null;
            fromContainer = -1;
            fromIndices   = null;
            currentPanel  = null;
        }
        /// <summary>
        /// When the player begins dragging an object
        /// </summary>
        /// <param name="containerIndex">The containers index</param>
        /// <param name="objectIndices">The object indices of the panel</param>
        public void ItemOnBeginDrag(int containerIndex, int[] objectIndices)
        {
            // Remember where the object is comming from
            fromContainer = containerIndex;
            fromIndices   = objectIndices;

            // Get the object from the sender
            fromObject = containers[fromContainer].GetObject(fromIndices, true);

            if (fromObject == null)
            {
                ItemOnEndDrag();
                return;
            }

            // Get the correct drag panel
            currentPanel = containers[containerIndex].dragPanel;

            // Set the object in the panel
            currentPanel.SetObject(fromObject);

            // Show the panel
            currentPanel.gameObject.SetActive(true);
        }