Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

UIUpgradeSlot.cs

Erik edited this page Apr 24, 2019 · 1 revision

Dependencies (What do I need to include to use this script in another projec?):
  • PlayerUpgrade
  • UIEquippedUpgradeSlot
Public Methods:
  • ClearSlot() - Resets the slot to show "no upgrade".
  • CreateSlot(PlayerUpgrade upgrade) - Assigns the ugprade to the slot and displays the image representing that upgrade.
Public Events:
  • None
Configurable Fields:
  • image - UI Element to display the Upgrade's image
  • draggableObjectParent - When an object is dragged from the upgrade slot, this transform is immediately set as its parent. Since UI elements rely on the GameObject hierarchy for sorting, this allows us to render the draggable object in front of all other UI elements. This transform should be at the bottom of your canvas hierarchy.
General Overview:

When an item is click-and-dragged, it follows the mouse until the drag is released. If the drag is released over a UIEquippedUpgradeSlot element it is equipped. Otherwise, it is returned to its original position.

Clone this wiki locally