private void Update() { #region closeMenues if (_activeMenu == ActiveMenuEnum.Inventory) { if (Input.GetButtonDown("Inventory") || Input.GetButtonDown("Cancel")) { DisableMenu(_inventory); _itemTooltip.HideTooltip(); OnInventoryClose?.Invoke(); } return; } if (_activeMenu == ActiveMenuEnum.Pause) { if (Input.GetButtonDown("Cancel")) { _pauseMenu.GetComponent <PauseMenu>().Back(); } return; } #endregion #region openMenues if (_activeMenu == ActiveMenuEnum.None) { if (Input.GetButtonDown("Inventory")) { _activeMenu = ActiveMenuEnum.Inventory; _inventory.SetActive(true); ToggleTime(); return; } if (Input.GetButtonDown("Cancel")) { _activeMenu = ActiveMenuEnum.Pause; _pauseMenu.SetActive(true); ToggleTime(); } } #endregion }
private void DisableMenu(GameObject menu) { menu.SetActive(false); ToggleTime(); _activeMenu = ActiveMenuEnum.None; }