public void previousLevel() { //for changing levels if (subLevelSecondary > 1) { subLevelSecondary--; } else { subLevelSecondary = 3; mainLevel--; subLevelMain = mainLevel; } SubLevelSecondary.GetComponent <TextMeshProUGUI>().text = subLevelSecondary.ToString(); SubLevelMain.GetComponent <TextMeshProUGUI>().text = subLevelMain.ToString(); MainLevel.GetComponent <TextMeshProUGUI>().text = mainLevel.ToString(); //for restricting level if (mainLevel == 1 && subLevelSecondary == 1) { PreviousLevelButton.GetComponent <Button>().interactable = false; LevelSelectionESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(NextLevelButton); } else { PreviousLevelButton.GetComponent <Button>().interactable = true; } NextLevelButton.GetComponent <Button>().interactable = true; }
public void nextLeveL() { if (subLevelSecondary < 3) { subLevelSecondary++; } else { subLevelSecondary = 1; mainLevel++; subLevelMain = mainLevel; } SubLevelSecondary.GetComponent <TextMeshProUGUI>().text = subLevelSecondary.ToString(); SubLevelMain.GetComponent <TextMeshProUGUI>().text = subLevelMain.ToString(); MainLevel.GetComponent <TextMeshProUGUI>().text = mainLevel.ToString(); if (mainLevel == 5 && subLevelSecondary == 3) { NextLevelButton.GetComponent <Button>().interactable = false; LevelSelectionESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(PreviousLevelButton); } else { NextLevelButton.GetComponent <Button>().interactable = true; } PreviousLevelButton.GetComponent <Button>().interactable = true; }