コード例 #1
0
ファイル: WorldSave.cs プロジェクト: cbirchallroman/annunaki
    public BasicWorldSave(GameObject go)
    {
        WorldController wc = go.GetComponent <WorldController>();

        world          = wc.Map;
        money          = new MoneySave(wc.money);
        actionSelecter = new ActionSelecterControllerSave(wc.actionSelecter);
        diplomacy      = new DiplomacySave(wc.diplomacy);
        scenario       = new ScenarioGoalsSave(wc.scenario);
        foreach (Transform t in wc.structures.transform)
        {
            GameObject str = t.gameObject;
            structures.Add(new StructureSave(str.gameObject));
        }
    }
コード例 #2
0
ファイル: WorldSave.cs プロジェクト: cbirchallroman/annunaki
    public WorldProgressSave(GameObject go)
    {
        WorldController wc = go.GetComponent <WorldController>();

        world = wc.Map;

        //SAVE IN-GAME STUFF
        time           = new TimeSave(wc.timeController);
        labor          = new LaborSave(wc.labor);
        money          = new MoneySave(wc.money);
        camera         = new CameraSave(wc.cameraController);
        immigration    = new ImmigrationSave(wc.immigration);
        actionSelecter = new ActionSelecterControllerSave(wc.actionSelecter);
        trade          = new TradeSave(wc.trade);
        diplomacy      = new DiplomacySave(wc.diplomacy);
        scenario       = new ScenarioGoalsSave(wc.scenario);

        //SAVE OBJECTS FROM PARENT
        //structures
        foreach (Transform t in wc.structures.transform)
        {
            GameObject str = t.gameObject;

            if (str.GetComponent <StorageBuilding>() != null)
            {
                storagebuildings.Add(new StorageBuildingSave(str));
            }

            else if (str.GetComponent <Stable>() != null)
            {
                stables.Add(new StableSave(str));
            }

            else if (str.GetComponent <Factory>() != null)
            {
                factories.Add(new FactorySave(str));
            }

            else if (str.GetComponent <Generator>() != null)
            {
                generators.Add(new GeneratorSave(str));
            }

            else if (str.GetComponent <Market>() != null)
            {
                markets.Add(new MarketSave(str.gameObject));
            }

            else if (str.GetComponent <House>() != null)
            {
                houses.Add(new HouseSave(str.gameObject));
            }

            else if (str.GetComponent <Workplace>() != null)
            {
                workplaces.Add(new WorkplaceSave(str.gameObject));
            }

            else if (str.GetComponent <Structure>() != null)
            {
                structures.Add(new StructureSave(str.gameObject));
            }
        }

        //walkers
        foreach (Transform t in wc.walkers.transform)
        {
            GameObject wlkr = t.gameObject;

            if (wlkr.GetComponent <Animal>() != null)
            {
                animals.Add(new AnimalSave(wlkr));
            }

            if (wlkr.GetComponent <Vender>() != null)
            {
                venders.Add(new VenderSave(wlkr));
            }

            else if (wlkr.GetComponent <Walker>() != null)
            {
                walkers.Add(new WalkerSave(wlkr));
            }
        }
    }
コード例 #3
0
 public void Load(ActionSelecterControllerSave a)
 {
     actionList = a.actionList;
 }
コード例 #4
0
    public WorldProgressSave(GameObject go)
    {
        WorldController w = go.GetComponent <WorldController>();

        world = w.Map;

        productivities = new DictContainer <string, float>(ProductivityController.productivities);
        automation     = new DictContainer <string, float>(ProductivityController.automationValue);

        saveDate = DateTime.Now;
        Debug.Log(saveDate.ToString("MM/dd/yyyy"));

        Events = w.notifications.Events;

        //SAVE IN-GAME STUFF
        time           = new TimeSave(w.timeController);
        population     = new PopulationSave(w.population);
        money          = new MoneySave(w.money);
        camera         = new CameraSave(w.cameraController);
        immigration    = new ImmigrationSave(w.immigration);
        actionSelecter = new ActionSelecterControllerSave(w.actionSelecter);
        trade          = new TradeSave(w.trade);
        diplomacy      = new DiplomacySave(w.diplomacy);
        scenario       = new ScenarioSave(w.scenario);
        research       = new ResearchSave(w.research);

        //SAVE OBJECTS FROM PARENT
        //structures
        foreach (Transform t in w.structures.transform)
        {
            GameObject str = t.gameObject;

            if (str.GetComponent <StorageBuilding>() != null)
            {
                storagebuildings.Add(new StorageBuildingSave(str));
            }

            else if (str.GetComponent <Stable>() != null)
            {
                stables.Add(new StableSave(str));
            }

            else if (str.GetComponent <Crop>() != null)
            {
                crops.Add(new CropSave(str));
            }

            else if (str.GetComponent <Generator>() != null)
            {
                generators.Add(new GeneratorSave(str));
            }

            else if (str.GetComponent <WTP>() != null)
            {
                wtps.Add(new WTPSave(str));
            }

            else if (str.GetComponent <Canal>() != null)
            {
                canals.Add(new CanalSave(str));
            }

            else if (str.GetComponent <House>() != null)
            {
                houses.Add(new HouseSave(str.gameObject));
            }

            else if (str.GetComponent <Farmhouse>() != null)
            {
                farmhouses.Add(new FarmhouseSave(str));
            }

            else if (str.GetComponent <Workplace>() != null)
            {
                workplaces.Add(new WorkplaceSave(str));
            }

            else if (str.GetComponent <Jobcentre>() != null)
            {
                jobcentres.Add(new JobcentreSave(str));
            }

            else if (str.GetComponent <Structure>() != null)
            {
                structures.Add(new StructureSave(str));
            }

            else
            {
                Debug.Log(str.name + " shouldn't be under structures");
            }
        }

        //walkers
        foreach (Transform t in w.walkers.transform)
        {
            GameObject wlkr = t.gameObject;

            if (wlkr.GetComponent <Animal>() != null)
            {
                animals.Add(new AnimalSave(wlkr));
            }

            else if (wlkr.GetComponent <Walker>() != null)
            {
                walkers.Add(new WalkerSave(wlkr));
            }

            else
            {
                Debug.Log(wlkr.name + " shouldn't be under walkers");
            }
        }
    }