public void LoadUnlockedLevel(int phaseNum) { if (PlayerPrefManagement.Unlocked(phaseNum)) { LoadLevel("Phase" + phaseNum + "_01"); } }
public static void UnlockConditions() { best1 = PlayerPrefManagement.GetBestPhase(1); best2 = PlayerPrefManagement.GetBestPhase(2); best3 = PlayerPrefManagement.GetBestPhase(3); best4 = PlayerPrefManagement.GetBestPhase(4); Unlocked_2 = best1 < 180f && best1 != 0; Unlocked_3 = best1 < 170f && best1 != 0 && best2 < 330f && best2 != 0; Unlocked_4 = best1 < 160f && best1 != 0 && best2 < 315f && best2 != 0 && best3 < 420f && best3 != 0; Unlocked_5 = best1 < 150f && best1 != 0 && best2 < 300f && best2 != 0 && best3 < 400f && best3 != 0 && best4 < 480f && best4 != 0; bool[] Unlocked = { Unlocked_2, Unlocked_3, Unlocked_4, Unlocked_5 }; for (int i = 0; i < Unlocked.Length; i++) { if (Unlocked [i]) { PlayerPrefManagement.UnlockPhase(i + 2); } } }
// Use this for initialization void Start() { P1.text = StopWatch.Convert(PlayerPrefManagement.GetBestPhase(1)); P2.text = StopWatch.Convert(PlayerPrefManagement.GetBestPhase(2)); P3.text = StopWatch.Convert(PlayerPrefManagement.GetBestPhase(3)); P4.text = StopWatch.Convert(PlayerPrefManagement.GetBestPhase(4)); P5.text = StopWatch.Convert(PlayerPrefManagement.GetBestPhase(5)); }
public void EraseAllData() { PlayerPrefManagement.SetBestPhase(0, 1); for (int i = 2; i <= 5; i++) { PlayerPrefManagement.SetBestPhase(0, i); PlayerPrefManagement.LockPhase(i); PlayerPrefManagement.UnmarkUnlockTextShown(i); } LoadLevel("Menu"); }
void Start() { UnlockConditions(); Text[] lockedTexts = { locked_2, locked_3, locked_4, locked_5 }; for (int i = 0; i < lockedTexts.Length; i++) { if (PlayerPrefManagement.Unlocked(i + 2)) { lockedTexts [i].text = ""; } } }
void HandleFinalTime() { if (PlayerPrefManagement.GetBestPhase(phaseNum) == 0 || PlayerPrefManagement.GetBestPhase(phaseNum) > rawTime) { PlayerPrefManagement.SetBestPhase(rawTime, phaseNum); bestTime = true; } if (bestTime) { recordText.text = "New Record!"; } else { recordText.text = ""; } }
void Start() { rawTime = StopWatch.time; timeString = StopWatch.Convert(rawTime); finalTime = this.GetComponent <Text> (); finalTime.text = timeString; phaseNum = GameManagement.phaseNum; titleText.text = "Phase " + phaseNum + " Complete!"; bestTime = false; HandleFinalTime(); Selection.UnlockConditions(); bool nextPhaseUnlocked = true; int maxPhase = 5; int idx = 0; for (int i = 2; i <= maxPhase && nextPhaseUnlocked; i++) { if (PlayerPrefManagement.Unlocked(i)) { idx = i; } else { nextPhaseUnlocked = false; } } if (idx != 0 && !PlayerPrefManagement.HasShownUnlockText(idx)) { phaseUnlocked.text = "Phase " + idx + " Unlocked!"; PlayerPrefManagement.MarkUnlockTextShown(idx); } else { phaseUnlocked.text = ""; } }