示例#1
0
        public void OnPointerClick(PointerEventData eventData)
        {
            //Get the players inventory and equipment
            Inventory playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
            Equipment playerEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <Equipment>();

            //Get the slot ui
            InventorySlotUI inventorySlot = GetComponentInParent <InventorySlotUI>();
            ActionSlotUI    actionSlot    = GetComponentInParent <ActionSlotUI>();

            //if this is an inventory slot
            if (inventorySlot)
            {
                int indexOfItem = inventorySlot._index;
                playerInventory.SelectItem(indexOfItem);
            }
            //if this is an action slot
            else if (actionSlot)
            {
                int indexOfItem = actionSlot._index;
                playerInventory.SelectItem(indexOfItem);
            }
            //if it is neither a inventory or a action slot then we are an equipment slot
            else
            {
                EquipmentSlotUI equipmentSlot = GetComponentInParent <EquipmentSlotUI>();
                EquipLocation   location      = equipmentSlot.EquipLocation;
                playerEquipment.Select(location);
            }
        }
示例#2
0
 public void DeleteAction(ActionSlotUI action)
 {
     actionSlots.Remove(action);
     action.DeleteSlot();
 }
示例#3
0
 public void AddActionSlot(ActionSlotUI action)
 {
     actionSlots.Add(action);
     AddNewEmptySlot();
 }
示例#4
0
 public void DisableUI()
 {
     actionSelectorUI.SetActive(false);
     currentActionSlot = null;
 }
示例#5
0
 public void EnableUI(ActionSlotUI actionSlot)
 {
     currentActionSlot = actionSlot;
     actionSelectorUI.SetActive(true);
 }