예제 #1
0
    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
    public void Load(ScenarioGoalsSave s)
    {
        populationGoal = s.populationGoal;
        openedVictory  = s.openedVictory;
        timeDelta      = s.timeDelta;

        housingGoalAmount = s.housingGoalAmount;
        housingGoalLevel  = s.housingGoalLevel;

        HousingLevels = s.HousingLevels;

        Prosperity     = s.Prosperity;
        prosperityGoal = s.prosperityGoal;

        storageGoals = s.storageGoals;

        levelDesc = s.levelDesc;

        if (CampaignManager.currentLevel == -1)
        {
            CampaignManager.currentLevel    = s.level;
            CampaignManager.currentCampaign = s.campaign;
        }
    }
예제 #3
0
    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));
            }
        }
    }