private void UpdateActiveItem() { if (items.Count == 0) { healthBar.Deactivate(); speedText.Deactivate(); } else { if (itemSelector == null) { itemSelector = Instantiate(itemSelectorPrefab); } itemSelector.transform.SetParent(items[itemIndex].transform, false); Item finalItem = items[itemIndex].GetComponent <Item>(); if (finalItem != null) { switch (finalItem.GetItemType()) { case ItemType.SPEED: speedText.Activate(finalItem.GetItemValue()); healthBar.Deactivate(); statusEffectBar.Deactivate(); break; case ItemType.HEALTH: speedText.Deactivate(); healthBar.Activate(finalItem.GetItemValue()); statusEffectBar.Deactivate(); break; case ItemType.BLEEDING: healthBar.Deactivate(); speedText.Deactivate(); statusEffectBar.Activate(finalItem.GetItemType()); break; } } } }