private void DisableButtons() { int currentLevel = PlayerPrefsController.GetLevelPrefs(); for (int i = currentLevel + 1; i < buttons.Count; i++) { buttons[i].enabled = false; ChangeButtonColor(buttons[i]); } }
// index = 0 <=> currentLevel = 1 private void SetLevelPrefs() { int indexLevel = PlayerPrefsController.GetLevelPrefs(); int max_level = PlayerPrefsController.GetMaxLevel(); if (max_level - indexLevel <= 1) //checking if it is last / maximum level { return; } int currentLevel = GetCurrentLevel(); //checking last enabled level if (currentLevel - 1 != indexLevel) { return; } indexLevel += 1; PlayerPrefsController.SetLevelPrefs(indexLevel); // FACEBOOK EVENT FacebookManager.Instance.LevelEnded(indexLevel); }