public void Detach() { //TODO: release gas to environmental air SetAnchored(false); SetSpriteLayer(); int neighboorPipes = 0; for (int i = 0; i < nodes.Count; i++) { var pipe = nodes[i]; pipe.nodes.Remove(this); pipe.SpriteChange(); neighboorPipes++; } nodes = new List <Pipe>(); Pipenet oldPipenet = pipenet; pipenet.RemovePipe(this); if (oldPipenet.members.Count == 0) { //we're the only pipe on the net, delete it oldPipenet.DeletePipenet(); return; } if (neighboorPipes == 1) { //we're at an edge of the pipenet, safe to remove return; } oldPipenet.Separate(); }
public void MergePipenet(Pipenet otherPipenet) { for (int i = 0; i < otherPipenet.members.Count; i++) { var pipe = otherPipenet.members[i]; AddPipeEXTRA(pipe); } otherPipenet.members = new List <Pipe>(); gasMix += otherPipenet.gasMix; otherPipenet.DeletePipenet(); }
public void Detach() { var foundMeters = MatrixManager.GetAt <Meter>(registerTile.WorldPositionServer, true); for (int i = 0; i < foundMeters.Count; i++) { var meter = foundMeters[i]; if (meter.anchored) { foundMeters[i].Detach(); } } //TODO: release gas to environmental air SetAnchored(false); SetSpriteLayer(false); int neighboorPipes = 0; for (int i = 0; i < nodes.Count; i++) { var pipe = nodes[i]; pipe.nodes.Remove(this); pipe.CalculateSprite(); neighboorPipes++; } nodes = new List <Pipe>(); Pipenet oldPipenet = pipenet; pipenet.RemovePipe(this); if (oldPipenet.members.Count == 0) { //we're the only pipe on the net, delete it oldPipenet.DeletePipenet(); return; } if (neighboorPipes == 1) { //we're at an edge of the pipenet, safe to remove return; } oldPipenet.Separate(); }