Exemple #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);
            }
        }
 public void DeleteAction(ActionSlotUI action)
 {
     actionSlots.Remove(action);
     action.DeleteSlot();
 }
 public void AddActionSlot(ActionSlotUI action)
 {
     actionSlots.Add(action);
     AddNewEmptySlot();
 }
Exemple #4
0
 public void DisableUI()
 {
     actionSelectorUI.SetActive(false);
     currentActionSlot = null;
 }
Exemple #5
0
 public void EnableUI(ActionSlotUI actionSlot)
 {
     currentActionSlot = actionSlot;
     actionSelectorUI.SetActive(true);
 }