コード例 #1
0
    public void LoadSavedGame(WorldProgressSave w)
    {
        Map = w.world;
        timeController.Load(w.time);
        population.Load(w.population);
        money.Load(w.money);
        cameraController.Load(w.camera);
        actionSelecter.Load(w.actionSelecter);
        immigration.Load(w.immigration);
        trade.Load(w.trade);
        diplomacy.Load(w.diplomacy);
        scenario.Load(w.scenario);
        research.Load(w.research);

        ProductivityController.LoadProductivities(w.productivities, w.automation);
        notifications.LoadEvents(w.Events);

        //load whitelist for items
        ResourcesDatabase.LoadWhitelist(w.Whitelist);

        //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;
        }
        foreach (ObjSave save in w.jobcentres)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.workplaces)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.storagebuildings)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.generators)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.stables)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.houses)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.wtps)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.canals)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.crops)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }
        foreach (ObjSave save in w.farmhouses)
        {
            LoadMapObject(save).transform.parent = structures.transform;
        }

        //walkers
        foreach (ObjSave save in w.animals)
        {
            LoadMapObject(save).transform.parent = walkers.transform;
        }
        foreach (ObjSave save in w.walkers)
        {
            LoadMapObject(save).transform.parent = walkers.transform;
        }
    }