示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 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);
         }
     }
 }