private void InventoryOpen() { if (isOpen) { return; } else { canvas.enabled = true; controller.lockCursor = false; blurEffect.enabled = true; OnOpen.Invoke(); Time.timeScale = 0; isOpen = true; } }
/// <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; } }
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(); } } }