public bool DeleteShipComponent(Coordinate position) { if (HasBlock(position) && GetBlock(position).HasShipComponent()) { var block = GetBlock(position); block.ShipComponent.RemoveAdditionalSetups(this); blueprint.RemoveShipComponent(position); var pipes = block.PipesWithOneEdge.Select(pipe => pipe.Edge).ToList(); ClearPipes(position, block.PipesWithOneEdge); pipes.ForeachPair((e1, e2) => AddDoubleEdgedPipe(position, e1, e2)); //switch (block.PipesWithOneEdge.Count) //{ // case 1: // block.PipesWithOneEdge.Clear(); // break; // case 2: // block.PipesWithBothEdges.Add(new DoubleEdgedPipe( // block.PipesWithOneEdge[0].Edge, block.PipesWithOneEdge[1].Edge)); // block.PipesWithOneEdge.Clear(); // break; // case 3: // block.PipesWithBothEdges.Add(new DoubleEdgedPipe( // block.PipesWithOneEdge[0].Edge, block.PipesWithOneEdge[1].Edge)); // block.PipesWithBothEdges.Add(new DoubleEdgedPipe( // block.PipesWithOneEdge[1].Edge, block.PipesWithOneEdge[2].Edge)); // block.PipesWithBothEdges.Add(new DoubleEdgedPipe( // block.PipesWithOneEdge[2].Edge, block.PipesWithOneEdge[0].Edge)); // block.PipesWithOneEdge.Clear(); // break; // case 4: // block.AddShipComponent(new EmptyShipComponent()); // break; // default: break; //} return(true); } return(false); }