public void DigButton() { if (observingSurface == null) { SelfShutOff(); return; } else { CleanSite cs = observingSurface.worksite as CleanSite; if (cs == null) { cs = observingSurface.gameObject.AddComponent <CleanSite>(); cs.Set(observingSurface, true); UIController.current.ShowWorksite(cs); } else { if (cs.diggingMission) { cs.StopWork(); } } StatusUpdate(); timer = STATUS_UPDATE_TIME; } }
public void Set(CubeBlock block, bool work_is_dig) { workObject = block; workObject.SetWorksite(this); dig = work_is_dig; if (dig) { Block b = GameMaster.mainChunk.GetBlock(block.pos.x, block.pos.y + 1, block.pos.z); if (b != null && (b.type == BlockType.Surface & b.worksite == null)) { CleanSite cs = b.gameObject.AddComponent <CleanSite>(); TransferWorkers(this, cs); cs.Set(b as SurfaceBlock, true); if (showOnGUI) { cs.ShowOnGUI(); showOnGUI = false; } StopWork(); return; } sign = Instantiate(Resources.Load <GameObject> ("Prefs/DigSign")).GetComponent <WorksiteSign>(); } else { sign = Instantiate(Resources.Load <GameObject>("Prefs/PourInSign")).GetComponent <WorksiteSign>(); } sign.worksite = this; sign.transform.position = workObject.transform.position + Vector3.up * Block.QUAD_SIZE; //FollowingCamera.main.cameraChangedEvent += SignCameraUpdate; mainResource = ResourceType.GetResourceTypeById(workObject.material_id); if (workersCount < START_WORKERS_COUNT) { GameMaster.colonyController.SendWorkers(START_WORKERS_COUNT, this); } if (!worksitesList.Contains(this)) { worksitesList.Add(this); } if (!subscribedToUpdate) { GameMaster.realMaster.labourUpdateEvent += WorkUpdate; subscribedToUpdate = true; } }
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(); } } } }