Beispiel #1
0
    public void ChangeInventoryTab(int tabValue)
    {
        DeselectAll();
        int index = inventoryTabs.IndexOf(currentActiveTab);

        currentActiveTab.gameObject.SetActive(false);
        index += tabValue;

        if (index <= -1)
        {
            index = inventoryTabs.Count - 1;
        }
        else if (index >= inventoryTabs.Count)
        {
            index = 0;
        }

        currentActiveTab = inventoryTabs[index];
        currentActiveTab.gameObject.SetActive(true);
        InitiateItems();
        if (currentActiveTab.GetFirstSlot() != null)
        {
            eventSystem.SetSelectedGameObject(currentActiveTab.GetFirstSlot());
        }
    }
Beispiel #2
0
 public void OpenInventory()
 {
     if (!inventoryInput.activeSelf)
     {
         currentActiveTab.gameObject.SetActive(true);
         inventoryInput.SetActive(!inventoryInput.activeSelf);
         if (eventSystem == null)
         {
             eventSystem = FindObjectOfType <EventSystem>();
         }
         InitiateItems();
         eventSystem.SetSelectedGameObject(currentActiveTab.GetFirstSlot());
         //playerController.SetGameState(GameState.PAUSED);
     }
 }