private void PageBackTurnFinished() { pageIndex--; pageIndex--; bookInSideBackPage.mainTexture = Book.GetPage(pageIndex); // hide the page PageArt.GetComponent <Renderer>().enabled = false; // re set it to the starting page. pageAnimator.SetBool("ClosePage", false); isPageBackTurning = false; }
private void Set_TurnPage() { PageArt.GetComponent <Renderer>().enabled = true; SetPageFront(pageIndex); SetPageBack(pageIndex + 1); bookInSideBackPage.mainTexture = Book.GetPage(pageIndex + 2); pageAnimator.SetBool("OpenPage", true); isPageTurning = true; }
private void Set_TurnBackPage() { PageArt.GetComponent <Renderer>().enabled = true; pageAnimator.SetBool("ClosePage", true); SetPageFront(pageIndex - 2); // the page before SetPageBack(pageIndex - 1); // the current page. bookInSideFrontPage.mainTexture = Book.GetPage(pageIndex - 3); // back two isPageBackTurning = true; }
private void GetObjects() { Transform[] allChildren = GetComponentsInChildren <Transform>(true); foreach (Transform child in allChildren) { if (child.name == "Book_Holder") { bookAnimator = child.GetComponent <Animator>(); } if (child.name == "Book_Mesh") { mainBook = child.gameObject; } if (child.name == "Page_Obj") { page = child.gameObject; pageAnimator = page.GetComponent <Animator>(); } } // validation if (bookAnimator == null) { TraceMessage_Error("EOP0001 : Failed to find the animator object on the main book named 'Book_Holder'"); } if (mainBook == null) { TraceMessage_Error("EOP0002 : Failed to find the main book object mesh named 'Book_Mesh'"); } if (page == null) { TraceMessage_Error("EOP0003 : Failed to find the page object where the page should be found."); } // Get the page allChildren = page.GetComponentsInChildren <Transform>(true); foreach (Transform child in allChildren) { if (child.name == "Page") { PageArt = child.gameObject; pageFrontMaterial = PageArt.GetComponent <Renderer>().materials[0]; pageBackMaterial = PageArt.GetComponent <Renderer>().materials[1]; } } if (PageArt == null) { TraceMessage_Error("EOP0004 : Failed to find the page object"); } if (pageFrontMaterial == null) { TraceMessage_Error("EOP0005 : Failed to find the page front material"); } if (pageBackMaterial == null) { TraceMessage_Error("EOP0006 : Failed to find the page back material"); } HidePage(); }