Пример #1
0
        /// <summary>
        /// Method to reset all the parameters and hide the image of the holder.
        /// </summary>
        public void clearEquippedItem()
        {
            if (currentSlot)
            {
                currentSlot.itemImage.enabled = true;
            }

            holderImage.enabled       = false;
            holderImage.raycastTarget = false;

            currentSlot = null;
        }
Пример #2
0
        /// <summary>
        /// Method to preload all the data from the itemSlot
        /// </summary>
        /// <param name="itemSlot">the item slot to be preloaded</param>
        public void preLoadEquippedItem(ItemGUISlot itemSlot)
        {
            // Reference to the item for later use in drop event
            currentSlot = itemSlot;

            // Reference to the original Item image from the Inventory slot
            Image originalImage = itemSlot.itemImage;

            // Scale and positioning the holder image over the original image in the slot
            holderImage.rectTransform.localScale = originalImage.rectTransform.localScale;
            holderImage.rectTransform.position   = originalImage.rectTransform.position;

            // set the holder image to be the same as the slot image
            holderImage.sprite = originalImage.sprite;

            // Disable the original image and enable the holder one
            originalImage.enabled     = false;
            holderImage.enabled       = true;
            holderImage.raycastTarget = true;
        }