public override bool AddAdjacent(Side side, Node node) { //Printer.Info($"ADDING ADJ: {node.Print()} to {Print()}"); bool added = false; if (Adjacents[side] == null) { added = true; Adjacents[side] = node; node.AddAdjacent(Sides.GetInverse(side), this); if (node is IOPipeNode) { IOPipeNode iOPipeNode = (IOPipeNode)node; iOPipeNode.AddConnectedContainer(this); } } return(added); }
public void ScanMoreIOPipes() { DataAccess DataAccess = DataAccess.GetDataAccess(); int x = (int)Position.X; int y = (int)Position.Y; List <Node> nodes = DataAccess.LocationNodes[Location]; Vector2 north = new Vector2(x, y - 1); Node northNode = nodes.Find(n => n.Position.Equals(north)); if (northNode != null && northNode is IOPipeNode) { IOPipeNode northIOPipeNode = (IOPipeNode)northNode; northIOPipeNode.AddConnectedContainer(this); } Vector2 south = new Vector2(x, y + 1); Node southNode = nodes.Find(n => n.Position.Equals(south)); if (southNode != null && northNode is IOPipeNode) { IOPipeNode southIOPipeNode = (IOPipeNode)southNode; southIOPipeNode.AddConnectedContainer(this); } Vector2 west = new Vector2(x + 1, y); Node westNode = nodes.Find(n => n.Position.Equals(west)); if (westNode != null && northNode is IOPipeNode) { IOPipeNode westIOPipeNode = (IOPipeNode)westNode; westIOPipeNode.AddConnectedContainer(this); } Vector2 east = new Vector2(x - 1, y); Node eastNode = nodes.Find(n => n.Position.Equals(east)); if (eastNode != null && northNode is IOPipeNode) { IOPipeNode eastIOPipeNode = (IOPipeNode)eastNode; eastIOPipeNode.AddConnectedContainer(this); } }