public void Delete(BlockAnnihilationOrder order) { if (destroyed) { return; } else { destroyed = true; } PrepareWorkbuildingForDestruction(order.GetStructureOrder()); if (subscribedToUpdate) { GameMaster.realMaster.labourUpdateEvent -= LabourUpdate; subscribedToUpdate = false; } if (planes != null) { PlaneAnnihilationOrder pao = order.GetPlaneOrder(); foreach (var p in planes) { p.Value.Annihilate(pao); } } Destroy(gameObject); }
public void Rebuild(BlockMaterialsList bml, bool i_natural, bool compensateStructures, bool redrawCall) { byte newmask = bml.GetExistenceMask(); byte x; for (byte i = 0; i < 8; i++) { x = (byte)(1 << i); if ((newmask & x) == 0) { // удаление if ((existingPlanesMask & x) != 0) { if (planes.ContainsKey(i)) { planes[i].Annihilate(PlaneAnnihilationOrder.DeletedBySystem(compensateStructures)); } } } else { // создание или изменение if ((existingPlanesMask & x) != 0 && planes != null && planes.ContainsKey(i)) { planes[i].ChangeMaterial(bml[i], redrawCall); } else { CreatePlane(i, bml[i], redrawCall); } } } myBlock.myChunk.RefreshBlockVisualising(myBlock); }
// private PlaneAnnihilationOrder ChangeCompensation(bool x) { var copy = new PlaneAnnihilationOrder(this); copy.compensateResources = x; return(copy); }
public void Annihilate(PlaneAnnihilationOrder order) { if (!order.chunkClearing && grassland != null) { grassland.Annihilate(order.GetGrasslandOrder()); } ClearSurface(order); }
override public void Annihilate(PlaneAnnihilationOrder order) { base.Annihilate(order); if (model != null) { Object.Destroy(model); } }
virtual public void Annihilate(PlaneAnnihilationOrder order) { if (!destroyed) { destroyed = true; if (extension != null) { extension.Annihilate(order); } else { if (mainStructure != null) { if (!mainStructureIsABlocker) { mainStructure.Annihilate(order.GetStructuresOrder()); } else { mainStructure.SectionDeleted(pos); } } } if (!order.chunkClearing) { if (haveWorksite) { GameMaster.realMaster.colonyController.RemoveWorksite(this); haveWorksite = false; } if (faceIndex == Block.UP_FACE_INDEX | faceIndex == Block.SURFACE_FACE_INDEX) { var b = host?.GetBlock(); if (b != null) { b.myChunk.needSurfacesUpdate = true; } } } } }
public void ClearSurface(PlaneAnnihilationOrder order) { if (structures == null) { myPlane.NullifyExtensionLink(this); return; } else { if (structures.Count > 0) { Structure se; StructureAnnihilationOrder strOrder = order.GetStructuresOrder(); for (int i = 0; i < structures.Count; i++) { se = structures[i]; if (se != null) { se.Annihilate(strOrder); } } structures = null; } if (order.recalculateSurface) { RecalculateSurface(); } else { if (order.deleteExtensionLink) { myPlane.NullifyExtensionLink(this); } } grassland?.Annihilate(order.GetGrasslandOrder()); } }
private PlaneAnnihilationOrder(PlaneAnnihilationOrder origin) { _vals = origin._vals; }