public void GatherButton() { if (observingSurface == null || observingSurface.destroyed) { SelfShutOff(); return; } else { bool newGatherSite = true; if (observingSurface.haveWorksite) { var w = colony.GetWorksite(observingSurface); if (w != null && w is GatherSite) { w.StopWork(true); newGatherSite = false; } } if (newGatherSite) { var gs = new GatherSite(observingSurface); UIController.current.ShowWorksite(gs); } StatusUpdate(); } }
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(System.IO.Stream fs, int count) { if (count < 0 | count > 1000) { Debug.Log("worksites loading error - incorrect count"); GameMaster.LoadingFail(); return; } if (count > 0) { Worksite w = null; Chunk chunk = GameMaster.realMaster.mainChunk; for (int i = 0; i < count; i++) { switch ((WorksiteType)fs.ReadByte()) { case WorksiteType.CleanSite: { w = CleanSite.Load(fs, chunk); break; } case WorksiteType.DigSite: { w = DigSite.Load(fs, chunk); break; } case WorksiteType.BlockBuildingSite: { w = BlockBuildingSite.Load(fs, chunk); break; } case WorksiteType.GatherSite: { w = GatherSite.Load(fs, chunk); break; } default: w = null; break; } } } }
public static GatherSite Load(System.IO.Stream fs, Chunk chunk) { var data = new byte[8]; fs.Read(data, 0, data.Length); Plane plane = null; if (chunk.GetBlock(data[0], data[1], data[2])?.TryGetPlane(data[3], out plane) == true) { var cs = new GatherSite(plane); cs.destructionTimer = System.BitConverter.ToSingle(data, 4); cs.LoadWorksiteData(fs); return(cs); } else { Debug.Log("gather site load error"); return(null); } }
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 GatherButton() { if (observingSurface == null) { SelfShutOff(); return; } else { GatherSite gs = observingSurface.worksite as GatherSite; if (gs == null) { gs = observingSurface.gameObject.AddComponent <GatherSite>(); gs.Set(observingSurface); UIController.current.ShowWorksite(gs); } else { gs.StopWork(); } StatusUpdate(); timer = STATUS_UPDATE_TIME; } }