public ConveyorTile RemoveConveyorLine(GridTile toRemove) { ConveyorTile first = new ConveyorTile(1, 1, tileWidth, tileHeight); foreach (GridTile t in gridTiles.ToList()) { if (toRemove.nodeInGrid == t.nodeInGrid) { ConveyorTile temp = (ConveyorTile)t; if (temp.PositionInLine == 0) { first = temp; } int index = gridTiles.IndexOf(t, 0); EmptyTile empty = new EmptyTile(t.Column, t.Row, tileWidth, tileHeight); gridTiles.Remove(t); gridTiles.Insert(index, empty); } } foreach (GridTile t in gridTiles.ToList()) { if (t.NextTile == first) { t.ClearNextTile(); break; } } return(first); }
public GridTile FindTileInRowColumnCoordinates(int targetColumn, int targetRow) { GridTile foundTile = new EmptyTile(targetColumn, targetRow, tileWidth, tileHeight); foreach (GridTile n in gridTiles) { if (n.Column == targetColumn && n.Row == targetRow) { foundTile = n; return(foundTile); } } return(foundTile); }
public GridTile FindTileInPixelCoordinates(float targetX, float targetY) { GridTile foundTile = new EmptyTile(-1, -1, tileWidth, tileHeight); foreach (GridTile n in gridTiles) { if ((n.Column * tileWidth) <= targetX && (n.Column * tileWidth) + tileWidth >= targetX && (n.Row * tileHeight) <= targetY && (n.Row * tileHeight) + tileHeight >= targetY) { foundTile = n; break; } } return(foundTile); }
public void RemoveNode(GridTile toRemove) { foreach (GridTile t in gridTiles) { if (t.NextTile == toRemove) { t.ClearNextTile(); break; } } int index = gridTiles.IndexOf(toRemove, 0); EmptyTile empty = new EmptyTile(toRemove.Column, toRemove.Row, tileWidth, tileHeight); gridTiles.Remove(toRemove); gridTiles.Insert(index, empty); }
public void RemoveMPA(GridTile toRemove) { foreach (GridTile t in gridTiles.ToList()) { if (t.NextTile != null && t.NextTile.nodeInGrid == toRemove.nodeInGrid) { t.ClearNextTile(); } if (t.nodeInGrid == toRemove.nodeInGrid) { int index = gridTiles.IndexOf(t, 0); EmptyTile empty = new EmptyTile(t.Column, t.Row, tileWidth, tileHeight); gridTiles.Remove(t); gridTiles.Insert(index, empty); } } }