public void Play() { int level = SaveLoader.LoadProgress().Level; level = Mathf.Clamp(level, 1, SceneManager.sceneCountInBuildSettings); SceneManager.LoadScene(level); }
void Start() { currentSettings = SaveLoader.LoadSettings(); currentProgress = SaveLoader.LoadProgress(); SubscribeToEvents(); if (currentProgress.Level == currentLevel) { // for (int i = 0; i < currentProgress.COINs; i++) onLanternLited?.Invoke(); if (currentProgress.COINs == 3) { OpenLevelDoor(); } } else { OnNextLevelEnter(); } onAssignCheckpoint?.Invoke(currentProgress.LastCheckpoint); onGameStarted?.Invoke(currentProgress); Debug.Log(currentProgress.COINs); }
public override void OnInspectorGUI() { if (GUILayout.Button("Clear progress")) { SaveLoader.SaveProgress(new Progress()); } if (GUILayout.Button("Log current progress to console")) { Debug.Log(SaveLoader.LoadProgress()); } DrawDefaultInspector(); }
void Start() { progress = SaveLoader.LoadProgress(); switch (progress.Level) { case 0: goto case 1; case 1: doors[1].GetComponent <Image>().sprite = imageNull; doors[1].GetComponent <Button>().interactable = false; goto case 2; case 2: doors[2].GetComponent <Image>().sprite = imageNull; doors[2].GetComponent <Button>().interactable = false; break; } }