// Use this for initialization void Start() { levelController = GameObject.Find("Level Controller").GetComponent <RockLevelController> (); mountainLevelStatus = GameObject.Find("Game Manager").GetComponent <MountainLevelsStatus> (); if (GameObject.Find("Right Star(Clone)") != null) { //Debug.Log ("3 Stars"); levelNumber = GameObject.Find("Level Controller").GetComponent <RockLevelController> ().GetLevelNumber(); //Debug.Log ("LEVEL NUMBER = " + levelNumber); if (levelNumber < 31) { mountainLevelStatus.SetStarNumberInArray(3, levelNumber - 1); if (mountainLevelStatus.GetLevelProgressionNumber() == 3 && levelController.GetLevelNumber() == 4) { mountainLevelStatus.IncrementLevelProgressionNumber(); } else if (mountainLevelStatus.GetLevelProgressionNumber() == 4 && levelController.GetLevelNumber() == 5) { mountainLevelStatus.IncrementLevelProgressionNumber(); } } else if (levelNumber < 61) { cityLevelStatus.SetStarNumberInArray(3, levelNumber - 31); } } else if (GameObject.Find("Middle Star(Clone)") != null) { if (levelNumber < 31) { mountainLevelStatus.SetStarNumberInArray(2, levelNumber - 1); } else if (levelNumber < 61) { cityLevelStatus.SetStarNumberInArray(2, levelNumber - 31); } //Debug.Log ("2 Stars"); } else if (GameObject.Find("Left Star(Clone)") != null) { if (levelNumber < 31) { mountainLevelStatus.SetStarNumberInArray(1, levelNumber - 1); } else if (levelNumber < 61) { cityLevelStatus.SetStarNumberInArray(1, levelNumber - 1); } //Debug.Log ("1 Star"); } }
// Use this for initialization void Start() { mountainLevelStatus = GameObject.Find("Game Manager").GetComponent <MountainLevelsStatus> (); cityLevelsStatus = GameObject.Find("Game Manager").GetComponent <CityLevelsStatus> (); cabinLevelsStatus = GameObject.Find("Game Manager").GetComponent <CabinLevelsStatus> (); launchpadLevelsStatus = GameObject.Find("Game Manager").GetComponent <LaunchpadLevelsStatus> (); socialManager = GameObject.Find("Game Manager").GetComponent <IOSSocialManager> (); mountainLevelHighScores = new int[30]; cityLevelHighScores = new int[30]; cabinLevelHighScores = new int[30]; launchpadLevelHighScores = new int[30]; if (!PlayerPrefs.HasKey("mountainLevelThreeStarsNumber")) { PlayerPrefs.SetInt("mountainLevelThreeStarsNumber", 0); } if (!PlayerPrefs.HasKey("cityLevelThreeStarsNumber")) { PlayerPrefs.SetInt("cityLevelThreeStarsNumber", 0); } if (!PlayerPrefs.HasKey("cabinLevelThreeStarsNumber")) { PlayerPrefs.SetInt("cabinLevelThreeStarsNumber", 0); } if (!PlayerPrefs.HasKey("launchpadLevelThreeStarsNumber")) { PlayerPrefs.SetInt("launchpadLevelThreeStarsNumber", 0); } // 0 is False and 1 is True for PlayerPref.GetInt when setting ThreeStarArrays; if (!PlayerPrefs.HasKey("mountainLevelThreeStarArrayIndex 0")) { for (int i = 0; i < 30; i++) { PlayerPrefs.SetInt("mountainLevelThreeStarArrayIndex " + i, 0); PlayerPrefs.SetInt("cityLevelThreeStarArrayIndex " + i, 0); PlayerPrefs.SetInt("cabinLevelThreeStarArrayIndex " + i, 0); PlayerPrefs.SetInt("launchpadLevelThreeStarArrayIndex " + i, 0); } } if (!PlayerPrefs.HasKey("mountainLevelHighScores 0")) { int temp = 0; for (int i = 0; i < 30; i++) { temp = mountainLevelStatus.GetStarNumber(i) * ((GetMountainLevelThreeStarScore(i) / 3) + Random.Range(0, 1000)); PlayerPrefs.SetInt("mountainLevelHighScores " + i, temp); mountainLevelHighScores[i] = temp; } for (int i = 0; i < 30; i++) { temp = cityLevelsStatus.GetStarNumber(i) * ((GetCityLevelThreeStarScore(i) / 3) + Random.Range(0, 1000)); PlayerPrefs.SetInt("cityLevelHighScores " + i, temp); cityLevelHighScores[i] = temp; } for (int i = 0; i < 30; i++) { temp = cabinLevelsStatus.GetStarNumber(i) * ((GetCabinLevelThreeStareScore(i) / 3) + Random.Range(0, 1000)); PlayerPrefs.SetInt("cabinLevelHighScores " + i, temp); cabinLevelHighScores[i] = temp; } for (int i = 0; i < 30; i++) { temp = launchpadLevelsStatus.GetStarNumber(i) * ((GetLaunchpadLevelThreeStarScore(i) / 3) + Random.Range(0, 1000)); PlayerPrefs.SetInt("launchpadLevelHighScores " + i, temp); launchpadLevelHighScores[i] = temp; } } else { for (int i = 0; i < 30; i++) { mountainLevelHighScores[i] = PlayerPrefs.GetInt("mountainLevelHighScores " + i); // Debug.Log ("mountainLevelHighScores[" + i + "] = " + mountainLevelHighScores[i]); } for (int i = 0; i < 30; i++) { cityLevelHighScores[i] = PlayerPrefs.GetInt("cityLevelHighScores " + i); // Debug.Log ("cityLevelHighScores[" + i + "] = " + cityLevelHighScores[i]); } for (int i = 0; i < 30; i++) { cabinLevelHighScores[i] = PlayerPrefs.GetInt("cabinLevelHighScores " + i); } for (int i = 0; i < 30; i++) { launchpadLevelHighScores[i] = PlayerPrefs.GetInt("launchpadLevelHighScores " + i); } } }