void Start() { //Setup moving page status moveImageRect = new Rect(0, 0, Screen.width, Screen.height * 2); // find the script for detecting touch swipeDetection = gameObject.GetComponent <DetectStraightSwipe>(); // find out if we can skip without listening if (Application.loadedLevelName.Equals("IntroStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedIntroStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("MouthStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedMouthStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("MouthEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedMouthEndStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("StomachStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedStomachStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("StomachEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedStomachEndStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("SmallIntestineStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedSIStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("SmallIntestineEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedSIEndStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("LargeIntestineStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedLIStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("LargeIntestineEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedLIEndStory") == 1) ? true : false; } // preload next scene StartCoroutine(loadNextLevel()); }
private AsyncOperation loader; //!< for preloading the next level /***************************************************************/ // Use this for initialization void Start() { charAdded = false; for (int i = 0; i < CharacterPage.Length; i++) { charSet.Add(CharacterPage [i]); Debug.Log("Page " + CharacterPage[i] + " added"); } int tempCharCounter = 0; for (int i = 0; i < PageImage.Length; i++) { PageList.Add(new Pages_2(PageImage [i], i)); if (charSet.Contains(i)) { //Texture[] tempCharTexture = new Texture[2]; Sprite[] tempCharTexture = new Sprite[2]; tempCharTexture [0] = CharacterImage [tempCharCounter]; tempCharTexture [1] = CharacterImage [tempCharCounter + 1]; PageList [i].setCharacter(tempCharTexture, XCharacterPosition [tempCharCounter], YCharacterPosition [tempCharCounter]); } } /**************************************************************/ swipeDetection = gameObject.GetComponent <DetectStraightSwipe> (); /**************************************************************/ }
DetectStraightSwipe swipeDetection; //!< to hold a reference to the script that controls swipe detection // Use this for initialization void Start() { // find the script for detecting touch swipeDetection = gameObject.GetComponent <DetectStraightSwipe> (); }
// Use this for initialization void Start() { image = GetComponent <Image>(); //storyChar = FindObjectOfType (typeof(StoryCharacter)) as StoryCharacter; charAdded = false; charTracker = 0; pageTurned = false; /* * for (int i = 0; i < CharacterPage.Length; i++) { * charSet.Add (CharacterPage [i]); * Debug.Log ("Page " + CharacterPage[i] + " added"); * } */ int tempCharCounter = 0; longPages = new bool[BackGroundImages.Length]; longPageDone = true; /* * for (int i = 0; i < longPages.Length; i++) { * longPages [i] = true; * }; */ /* * for (int i = 0; i < BackGroundImages.Length; i++) { * PageList.Add (new Pages_Sprites (BackGroundImages [i], i)); * * if (charSet.Contains (i)) { * Sprite[] tempCharSprite = new Sprite[2]; * * tempCharSprite [0] = CharacterImage [tempCharCounter*2]; * tempCharSprite [1] = CharacterImage [tempCharCounter*2 + 1]; * * PageList [i].setCharacter (tempCharSprite, XCharacterPosition [tempCharCounter], YCharacterPosition [tempCharCounter]); * tempCharCounter++; * } * * } */ /**************************************************************/ swipeDetection = gameObject.GetComponent <DetectStraightSwipe> (); // find out if we can skip without listening if (Application.loadedLevelName.Equals("IntroStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedIntroStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("MouthStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedMouthStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("MouthEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedMouthEndStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("StomachStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedStomachStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("StomachEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedStomachEndStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("SmallIntestineStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedSIStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("SmallIntestineEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedSIEndStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("LargeIntestineStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedLIStory") == 1) ? true : false; } else if (Application.loadedLevelName.Equals("LargeIntestineEndStoryboard")) { canSkip = (PlayerPrefs.GetInt("PlayedLIEndStory") == 1) ? true : false; } //Just for testing //canSkip = false; // preload next scene StartCoroutine(loadNextLevel()); /**************************************************************/ }