private void Start() { btSaveManager newSave = new btSaveManager(); newSave.LoadXML(); /// Find and disable all buttons that the player has not yet reached btLoadLevelButton[] levelButtons = Object.FindObjectsOfType(typeof(btLoadLevelButton)) as btLoadLevelButton[]; foreach (btLoadLevelButton button in levelButtons) { if (button.levelNumber > newSave.levelProgress + 1) { button.GetComponentInChildren <UISlicedSprite>().color = Color.grey; button.GetComponent <Collider>().enabled = false; button.enabled = false; } } }
public void CompleteLevel() { this.currentState = GAMESTATE.IDLE; btSaveManager saveFile = new btSaveManager(); saveFile.LoadXML(); // If the player is firther than they have been before, // then a special message will be played when they get back to the menu // ( if it is the last level ) int oldProgress = saveFile.levelProgress; if (oldProgress > this.levelNumber) { this.gameFinale = true; } saveFile.levelProgress = Mathf.Max(oldProgress, this.levelNumber); saveFile.SaveXML(); // Update the save file btUIManager.instance.ShowLevelCompleteDialog(); }