A 2D Farming RPG
This is just a simple 2D farming RPG game
Loading...
Searching...
No Matches
SaveLoadManager.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine.SceneManagement;
3
8public class SaveLoadManager : SingletonMonobehaviour<SaveLoadManager>
9{
10 public List<ISaveable> iSaveableObjectList;
11
12 protected override void Awake()
13 {
14 base.Awake();
15 iSaveableObjectList = new List<ISaveable>();
16 }
17
22 {
23 foreach( ISaveable iSaveableObject in iSaveableObjectList )
24 {
25 iSaveableObject.ISaveableStoreScene( SceneManager.GetActiveScene().name );
26 }
27 }
28
33 {
34 foreach( ISaveable iSaveableObject in iSaveableObjectList )
35 {
36 iSaveableObject.ISaveableRestoreScene( SceneManager.GetActiveScene().name );
37 }
38 }
39}
Manage saving and loading scenes. This class is a singleton instance.
void StoreCurrentSceneData()
Loop through all ISaveable objects and trigger store scene data for each
void RestoreCurrentSceneData()
Loop through all ISaveable objects and trigger restore scene data for each
List< ISaveable > iSaveableObjectList
override void Awake()
Abstract class that inherited by all the game managers. All the game managers use singleton since gam...
Interface for unity ISaveable
Definition: ISaveable.cs:5
void ISaveableRestoreScene(string sceneName)
void ISaveableStoreScene(string sceneName)