コード例 #1
0
 /// <summary>
 /// Called when a right swipe is detected. Turns the left page if there are pages left. Plays the pageTurn audio clip.</summary>
 public void onSwipeRight()
 {
     if (currentSheetNum == 2)
     {
         AudioSource.PlayClipAtPoint(pageTurn, Vector3.zero);
         currentSheetNum--;
         PageScript temp = pageRightScript;
         pageRightScript = pageLeftScript;
         GameObject obj = (GameObject)Instantiate(pagePrefab, new Vector3(-0.75f, 0, 0), Quaternion.Euler(new Vector3(0, 180, 0)));
         pageLeftScript = obj.GetComponent <PageScript> ();
         pageLeftScript.mInitialize(currentSheetNum - 1, null, null);
         pageRightScript.rotateRight(40, temp.gameObject);
     }
     else if (currentSheetNum > 1)
     {
         AudioSource.PlayClipAtPoint(pageTurn, Vector3.zero);
         currentSheetNum--;
         PageScript temp = pageRightScript;
         pageRightScript = pageLeftScript;
         GameObject obj = (GameObject)Instantiate(pagePrefab, new Vector3(-0.75f, 0, 0), Quaternion.Euler(new Vector3(0, 180, 0)));
         pageLeftScript = obj.GetComponent <PageScript> ();
         pageLeftScript.mInitialize(currentSheetNum - 1, imageList [(currentSheetNum - 1) * 2 - 2], imageList [(currentSheetNum - 1) * 2 - 1]);
         pageRightScript.rotateRight(40, temp.gameObject);
     }
 }
コード例 #2
0
 /// <summary>
 /// Closes the book and initiates it's animation back to the shelf.</summary>
 public void closeBook()
 {
     bookCover.GetComponent <BookCoverScript> ().closeBook(40, pageLeftScript.gameObject, pageRightScript.gameObject);
     pageLeftScript.rotateRight(50, null);
 }