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); } }
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>(); }
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>(); }
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); } } }
public void Awake() { Instance = this; }