/// <summary> /// Called when a left swipe is detected. Turns the right page if there are pages left. Plays the pageTurn audio clip.</summary> public void onSwipeLeft() { if (currentSheetNum * 2 + 2 <= imageList.Length) { AudioSource.PlayClipAtPoint(pageTurn, Vector3.zero); currentSheetNum++; PageScript temp = pageLeftScript; pageLeftScript = pageRightScript; GameObject obj = (GameObject)Instantiate(pagePrefab, new Vector3(0.75f, 0, 0), Quaternion.identity); pageRightScript = obj.GetComponent <PageScript> (); pageRightScript.mInitialize(currentSheetNum, imageList [currentSheetNum * 2 - 2], imageList [currentSheetNum * 2 - 1]); pageLeftScript.rotateLeft(40, temp.gameObject); } }
/// <summary> /// Opens the book. Should be called only after it has reached the table.</summary> public void openBook() { mInitialize(); bookCover.GetComponent <BookCoverScript> ().openBook(50); pageLeftScript.rotateLeft(40, null); }