private void Start() { Enums.LoadDictionaries(); BasicWorldSave save = SaveLoadMap.GetGameData(); //load world if it exists if (save != null) { if (save is WorldProgressSave) { LoadSavedGame((WorldProgressSave)save); } else { LoadScenario(save); } } else { CreateWorld(); } GenerateWorld(); }
public static BasicWorldSave GetScenarioFromResources(string dir, string name) { Debug.Log("this"); TextAsset file = Resources.Load <TextAsset>(dir + "/" + name); MemoryStream str = new MemoryStream(file.bytes); BinaryFormatter bf = new BinaryFormatter(); BasicWorldSave savedGame = (BasicWorldSave)bf.Deserialize(str); str.Close(); return(savedGame); }
public void LoadScenario(BasicWorldSave w) { Map = w.world; money.Load(w.money); actionSelecter.Load(w.actionSelecter); diplomacy.Load(w.diplomacy); scenario.Load(w.scenario); //GO THROUGH LISTS OF OBJECTS AND ACTIVATE THEM USING THE LOADMAPOBJECT() FUNCTION //structures foreach (ObjSave save in w.structures) { LoadMapObject(save).transform.parent = structures.transform; } labor.InstantiateLabor(); if (notifications != null) { notifications.FreshEvents(); } }
public void LoadScenario(BasicWorldSave w) { Map = w.world; money.Load(w.money); actionSelecter.Load(w.actionSelecter); diplomacy.Load(w.diplomacy); scenario.Load(w.scenario); //GO THROUGH LISTS OF OBJECTS AND ACTIVATE THEM USING THE LOADMAPOBJECT() FUNCTION //structures foreach (ObjSave save in w.structures) { LoadMapObject(save).transform.parent = structures.transform; } if (notifications != null) { notifications.FreshEvents(); } //load whitelist for items ResourcesDatabase.LoadWhitelist(w.Whitelist); }