/// <summary> /// Initialize instance of this Game Manager /// </summary> protected void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } // load player save file m_Save = GameSave.Load(Application.dataPath + PLAYER_SAVE_FILE); if (m_Save == null) { m_Save = new PlayerSave(); // add first chapter save SaveSlot newSaveSlot = new SaveSlot(); m_Save.chaptersSave = new List <SaveSlot>(); m_Save.chaptersSave.Add(newSaveSlot); } }
/// <summary> /// Load last game session /// </summary> public void Continue() { saveSlot = m_Save.chaptersSave[m_Save.lastSaveSlotPlayed]; }
/// <summary> /// Load game session at slot index /// </summary> public void LoadGame(int savedSlotIndex) { saveSlot = m_Save.chaptersSave[savedSlotIndex]; m_Save.lastSaveSlotPlayed = savedSlotIndex; }