Esempio n. 1
0
 private void InventoryOpen()
 {
     if (isOpen)
     {
         return;
     }
     else
     {
         canvas.enabled        = true;
         controller.lockCursor = false;
         blurEffect.enabled    = true;
         OnOpen.Invoke();
         Time.timeScale = 0;
         isOpen         = true;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Method called to open inventory. Has event callback
        /// </summary>
        private void InventoryOpen()
        {
            if (isOpen)
            {
                return;
            }
            else
            {
                if (pickupItem.interactionType != InteractionType.clickToPickup)
                {
                    Cursor.visible   = true;
                    Cursor.lockState = CursorLockMode.None;
                }

                canvas.enabled = true;
                OnOpen.Invoke();
                isOpen = true;
            }
        }
Esempio n. 3
0
    private void ToggleInventory()
    {
        //only toggle the inventory if in the normal game state/mode.
        if (GlobalGame.Instance.CurrentGameState == GlobalGame.GameState.Normal)
        {
            InventoryCanvas.gameObject.SetActive(!InventoryCanvas.gameObject.activeSelf);
        }

        //find first selectable button in inventory
        Toggle btn = InventoryCanvas.GetComponentInChildren <Toggle>();

        //if the inventory had just been set to active and there is a button that can be pressed then put it in focus.
        if (InventoryCanvas.gameObject.activeSelf)
        {
            if (OnInventoryOpen != null)
            {
                OnInventoryOpen.Invoke();
            }
            if (btn)
            {
                btn.Select();
            }
        }
    }