Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void UnlockLevel (int level)
- {
- if (level <= Application.levelCount - 1)
- {
- PlayerPrefs.SetInt(LEVEL_KEY + level.ToString(), 1);//Use 1 for true
- }
- else
- {
- Debug.LogError("Trying to unlock level not in build order");
- }
- }
- public static bool IsLevelUnlocked (int level)
- {
- int levelValue = PlayerPrefs.GetInt(LEVEL_KEY + level.ToString());
- bool isLevelUnlocked = (levelValue == 1);
- if (level <= Application.levelCount - 1)
- {
- return isLevelUnlocked;
- }
- else
- {
- Debug.LogError("Trying to query level not in build order");
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement