public void Load() { IGameSave newsave = GameSaveManager.m_Instance.GetLoadedInfo(this.GetType()); m_LoadedSuccessfully = false; if (newsave != null) { FieldInfo[] fields = this.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo[] newfields = newsave.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); for (int i = 0; i < fields.Length; i++) { fields[i] = newfields[i]; fields[i].SetValue(this, newfields[i].GetValue(newsave));// = newfields[i]; } m_LoadedSuccessfully = true; } }
public void AddSaveStruct(IGameSave gameSave) { for (int i = 0; i < m_GameSave.Count; i++) { if (m_GameSave[i].GetType() == gameSave.GetType()) { m_GameSave[i] = gameSave; //SaveGame(); return; } } m_GameSave.Add(gameSave); //SaveGame(); }