public void Load(ColonyControllerSerializer ccs) { if (storage == null) { storage = gameObject.AddComponent <Storage>(); } storage.Load(ccs.storageSerializer); gears_coefficient = ccs.gears_coefficient; labourEfficientcy_coefficient = ccs.labourEfficientcy_coefficient; happiness_coefficient = ccs.happiness_coefficient; health_coefficient = ccs.health_coefficient; birthrateCoefficient = ccs.birthrateCoefficient; energyStored = ccs.energyStored; energyCrystalsCount = ccs.energyCrystalsCount; if (ccs.worksites.Count > 0) { foreach (WorksiteSerializer ws in ccs.worksites) { Worksite w = null; switch (ws.type) { case WorksiteType.BlockBuildingSite: w = new BlockBuildingSite(); break; case WorksiteType.CleanSite: w = new CleanSite(); break; case WorksiteType.DigSite: w = new DigSite(); break; case WorksiteType.GatherSite: w = new GatherSite(); break; case WorksiteType.TunnelBuildingSite: w = new TunnelBuildingSite(); break; } w.Load(ws); } } freeWorkers = ccs.freeWorkers; citizenCount = ccs.citizenCount; deathCredit = ccs.deathCredit; peopleSurplus = ccs.peopleSurplus; housingTimer = ccs.housingTimer; starvationTimer = ccs.starvationTimer; starvationTime = ccs.starvationTime; realBirthrate = ccs.realBirthrate; birthrateCoefficient = ccs.birthrateCoefficient; }
public static void StaticLoad(WorksiteSerializer[] wdata) { worksitesList = new List <Worksite>(wdata.Length); Worksite w = null; for (int i = 0; i < worksitesList.Count; i++) { switch (wdata[i].type) { default: w = null;; break; case WorksiteType.BlockBuildingSite: w = new BlockBuildingSite(); break; case WorksiteType.CleanSite: w = new CleanSite(); break; case WorksiteType.DigSite: w = new DigSite(); break; case WorksiteType.GatherSite: w = new GatherSite(); break; case WorksiteType.TunnelBuildingSite: w = new TunnelBuildingSite(); break; } if (w != null) { w.Load(wdata[i]); worksitesList[i] = w; } } }
public void DigCube() { if (chosenCube == null) { return; } else { if (faceIndex == 4) { SurfaceBlock sb = chosenCube.myChunk.GetBlock(chosenCube.pos.x, chosenCube.pos.y + 1, chosenCube.pos.z) as SurfaceBlock; if (sb == null) { DigSite ds = chosenCube.gameObject.AddComponent <DigSite>(); ds.Set(chosenCube, true); workingObserver = ds.ShowOnGUI(); // вообще они должны сами в конце цепочки устанавливать здесь workingObserver, не? } else { CleanSite cs = chosenCube.gameObject.AddComponent <CleanSite>(); cs.Set(sb, true); workingObserver = cs.ShowOnGUI(); } } else { if (faceIndex < 4) { TunnelBuildingSite tbs = chosenCube.gameObject.AddComponent <TunnelBuildingSite>(); tbs.Set(chosenCube); tbs.CreateSign(faceIndex); workingObserver = tbs.ShowOnGUI(); } } } }