void Update() { if (flippingStarted) { elapsedTime += Time.deltaTime; if (elapsedTime > DelayBeforeStart) { if (nextPageCountDown < 0) { if ((ControledBook.CurrentPaper < targetPaper && Mode == FlipMode.RightToLeft) || (ControledBook.CurrentPaper > targetPaper && Mode == FlipMode.LeftToRight)) { isPageFlipping = true; PageFlipper.FlipPage(ControledBook, PageFlipTime, Mode, () => { isPageFlipping = false; }); } else { flippingStarted = false; ControledBook.interactable = isBookInteractable; this.enabled = false; } nextPageCountDown = PageFlipTime + TimeBetweenPages + Time.deltaTime; } nextPageCountDown -= Time.deltaTime; } } }
public void FlipLeftPage() { if (isPageFlipping) { return; } if (ControledBook.CurrentPaper <= 0) { return; } isPageFlipping = true; PageFlipper.FlipPage(ControledBook, PageFlipTime, FlipMode.LeftToRight, () => { isPageFlipping = false; }); }
public void FlipRightPage() { if (isPageFlipping) { return; } if (ControledBook.CurrentPaper >= ControledBook.papers.Length) { return; } isPageFlipping = true; PageFlipper.FlipPage(ControledBook, PageFlipTime, FlipMode.RightToLeft, () => { isPageFlipping = false; }); }