void Update() //se till att rätt saker händer när rätt knappar trycks på { if (Input.GetButtonDown("GoBack")) { foreach (Button goBackButton in pM.GoBackButtons) { if (goBackButton.gameObject.activeInHierarchy) { goBackButton.onClick.Invoke(); return; } } } if (!coolingDown) currentNav(); //Delegate method changing depending on which part of the inventory is currently being navigated } #endregion #region NavMethods void InGameNav() { if (!coolingDown && inputManager.CurrentInputMode == InputMode.Playing) //Låter spelaren dra och stoppa undan det senast equippade vapnet { if (Input.GetButtonDown("QuickDraw")) { StartCoroutine(MenuCooldown()); if (combat.CurrentWeapon != null) { combat.WeaponToEquip = null; combat.SheatheAndUnsheathe(); } else if (combat.LastEquippedWeapon != null) { combat.WeaponToEquip = combat.LastEquippedWeapon; combat.SheatheAndUnsheathe(); } } else if (Input.GetButtonDown("Inventory")) { ShowInventory(); } if (!equippingFavorite) { bool controllerInput = Input.GetAxisRaw("NextInventoryRow") == 0f ? false : true; if (!controllerInput) controllerInput = Input.GetAxisRaw("NextItem") == 0f ? false : true; if (Input.GetAxisRaw("NextInventoryRow") > 0f || Input.GetKeyDown(KeyCode.Alpha1)) { EquipFavorite(0, controllerInput); } else if (Input.GetAxisRaw("NextItem") > 0f || Input.GetKeyDown(KeyCode.Alpha2)) { EquipFavorite(1, controllerInput); } else if (Input.GetAxisRaw("NextInventoryRow") < 0f || Input.GetKeyDown(KeyCode.Alpha3)) { EquipFavorite(2, controllerInput); } else if (Input.GetAxisRaw("NextItem") < 0f || Input.GetKeyDown(KeyCode.Alpha4)) { EquipFavorite(3, controllerInput); } } } } void ItemNav() { if (inputManager.CurrentInputMode == InputMode.Inventory) { if (Input.GetButtonDown("Inventory")) { HideInventory(); } else if (!coolingDown && !upgrading) { if (!itemSelected) //Låter spelaren navigera i inventoryt via handkontroll { if (Input.GetAxis("NextInventoryRow") < 0f) { ChangeInventoryRow(true); } else if (Input.GetAxis("NextInventoryRow") > 0f) { ChangeInventoryRow(false); } else if (Input.GetAxisRaw("NextItem") < 0f) { HighlightNextItem(false); } else if (Input.GetAxisRaw("NextItem") > 0f) { HighlightNextItem(true); } if (Input.GetButtonDown("PreviousInventoryCategory")) { if (displayCollection == 0) { DisplayNewCollection(playerInventory.Length - 1); } else DisplayNewCollection(displayCollection - 1); } else if (Input.GetButtonDown("NextInventoryCategory")) { DisplayNewCollection((displayCollection + 1) % playerInventory.Length); } } if (itemSelected) { if (Input.GetButtonDown("Favorite")) { favoriteButton.GetComponent