public void UnlinkRight() { if (RightGrid == null) { return; } // unlink all the nodes for (int y = 0; y < kGridHeight; ++y) { SpringNode otherNode = RightGrid.GetNode(0, y); otherNode.Left = null; otherNode = RightGrid.GetNode(0, y - 1); if (otherNode != null) { otherNode.UL = null; } otherNode = RightGrid.GetNode(0, y + 1); if (otherNode != null) { otherNode.DL = null; } } RightGrid.LeftGrid = null; RightGrid = null; }
public void LinkRight(SpringGrid rightGrid) { if (RightGrid != null) { UnlinkRight(); } RightGrid = rightGrid; RightGrid.LeftGrid = this; for (int y = 0; y < kGridHeight; ++y) { // We leave the far-rightmost grid node as a mirror of the leftmost grid node in the next grid // So link the left-side nodes from the next grid to the 2nd-from-the-right nodes in this grid SpringNode thisNode = GetNode(kGridWidth - 2, y); SpringNode otherNode = RightGrid.GetNode(0, y); otherNode.Left = thisNode; otherNode = RightGrid.GetNode(0, y - 1); if (otherNode != null) { otherNode.UL = thisNode; } otherNode = RightGrid.GetNode(0, y + 1); if (otherNode != null) { otherNode.DL = thisNode; } } }
public void LinkRight(SpringGrid rightGrid) { if (RightGrid != null) UnlinkRight(); RightGrid = rightGrid; RightGrid.LeftGrid = this; for(int y = 0; y < kGridHeight; ++y) { // We leave the far-rightmost grid node as a mirror of the leftmost grid node in the next grid // So link the left-side nodes from the next grid to the 2nd-from-the-right nodes in this grid SpringNode thisNode = GetNode(kGridWidth - 2, y); SpringNode otherNode = RightGrid.GetNode(0, y); otherNode.Left = thisNode; otherNode = RightGrid.GetNode(0, y - 1); if (otherNode != null) otherNode.UL = thisNode; otherNode = RightGrid.GetNode(0, y + 1); if(otherNode != null) otherNode.DL = thisNode; } }