/// <summary> /// Called when the player hits the right navigation button. Goes to the next page /// that is to the right of the currentPage in the list of InventoryPages. /// Also, show the left navigation button as needed. /// </summary> public void NavigatePageRight() { // Get the current page int current = currentPage.GetPageIndex(); // Hide that page currentPage.HidePage(); Debug.Log(currentPage.name); // Display the next page InventoryPage nextPage = inventoryPages[current + 1]; nextPage.DisplayPage(); currentPage = nextPage; // Check if need to show this button again (if there's another page to the right) if (totalPages - 1 == nextPage.GetPageIndex()) { // Hide the button rightNavButton.SetActive(false); } // Show the left button leftNavButton.SetActive(true); // Set the text inventoryText.SetPageNumber(current + 1, totalPages); }
/// <summary> /// Show the inventory menu by setting it's canvas as true. /// </summary> public void DisplayInventory() { UI.GetComponent <Canvas>().enabled = true; currentPage.DisplayPage(); isUIActive = true; }