Esempio n. 1
0
        private void Update()
        {
            for (int i = 0; i < Keys.Length; i++)
            {
                if (Input.GetKeyDown(Keys[i]))
                {
                    // Try to equip the i'th item.
                    int found = 0;
                    for (int j = 0; j < equippedItems.Length; j++)
                    {
                        if (equippedItems[j] == null)
                        {
                            continue;
                        }

                        if (found == i && found != currentIndex)
                        {
                            SetActiveItem(j);
                        }
                        found++;
                    }
                    break;
                }
            }

            if (hotbar == null)
            {
                hotbar = GlobalUIElement.Get <UI_Hotbar>();
            }

            if (hotbar != null)
            {
                hotbar.UpdateIcons(this);
            }
        }
Esempio n. 2
0
    void Awake()
    {
        inv          = inventoryGO.GetComponent <UI_Inventory>();
        itemList     = inventoryGO.GetComponent <UI_ItemsList>();
        eventManager = inventoryGO.GetComponent <UI_EventManager>();
        hotbar       = inventoryGO.GetComponent <UI_Hotbar>();

        if (playerEquipGO == null)
        {
            playerEquipGO = GameObject.Find("PlayerEquipment");
        }
        playerEquipment = playerEquipGO.GetComponent <UI_PlayerEquipment>();
    }
Esempio n. 3
0
 void Awake()
 {
     inventoryGO  = GameObject.Find("Ultimate Inventory Pro");
     inv          = inventoryGO.GetComponent <UI_Inventory>();
     itemList     = inventoryGO.GetComponent <UI_ItemsList>();
     eventManager = inventoryGO.GetComponent <UI_EventManager>();
     hotbar       = inventoryGO.GetComponent <UI_Hotbar>();
     if (playerEquipGO == null)
     {
         playerEquipGO = GameObject.Find("PlayerEquipment");
     }
     playerEquipment = playerEquipGO.GetComponent <UI_PlayerEquipment>();
     conScript       = container.GetComponent <UI_Container>();
 }
Esempio n. 4
0
 void Awake()
 {
     inv       = GetComponent <UI_Inventory>();
     itemsList = GetComponent <UI_ItemsList>();
     htbar     = GetComponent <UI_Hotbar>();
     GameObject[] allGO = GameObject.FindObjectsOfType <GameObject>();
     foreach (GameObject obj in allGO)
     {
         if (obj.GetComponent <UI_Container>() != null)
         {
             containers.Add(obj);
         }
     }
 }
Esempio n. 5
0
 public void Awake()
 {
     Instance = this;
 }