Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public Button[] levelButtons;
  2. [SerializeField] private Image progressBar;
  3. public GameObject loadingCanvas;
  4. public GameObject loadWorldOneCanvas;
  5. public GameObject loadWorldTwoCanvas;
  6.  
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10.  
  11. int LevelPassed = PlayerPrefs.GetInt("LevelPassed");
  12.  
  13. for (int i = 1; i < levelButtons.Length; i++)
  14. {
  15.  
  16. if (LevelPassed >= i + 1)
  17. {
  18. levelButtons[i].interactable = true;
  19. }
  20. else
  21. {
  22. levelButtons[i].interactable = false;
  23. }
  24.  
  25. }
  26.  
  27. }
  28.  
  29. public void LoadLevel(int sceneIndex)
  30. {
  31. StartCoroutine(LoadAsynchThenLevel(sceneIndex));
  32.  
  33. }
  34.  
  35.  
  36. public void ResetPlayerPrefs()
  37. {
  38. PlayerPrefs.DeleteAll();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement