Example #1
0
    public void ToggleInventoryMenu()
    {
        //If in the inventory script we were selecting the player, stop selecting it and stop the fct.
        if (inventoryScript.selectingPlayer)
        {
            inventoryScript.SelectingPlayer(false);
            return;
        }

        //Activate/Deactivate the needen menus
        inventoryActive = !inventoryActive;
        inventoryMenu.SetActive(inventoryActive);

        pauseGameButtons.SetActive(!inventoryActive);

        if (inventoryActive == false)
        {
            //IF we are disabling the inventory menu, deactivate it and set the focus to the hidden button
            inventoryScript.DeactivateInventoryMenu();

            if (lastSelectedButton == null)
            {
                eventSys.SetSelectedGameObject(pauseFirstSelectedButton);
            }
            else
            {
                eventSys.SetSelectedGameObject(lastSelectedButton);
            }
        }
        else
        {
            lastSelectedButton = eventSys.currentSelectedGameObject;
            inventoryScript.ActivateInventoryMenu();    //Else activate the inventory menu
        }
    }