Exemple #1
0
 public Cell(int col, int row, CellSide rightWall, CellSide bottomWall, ModelMap map)
 {
     this.myColumn     = col;
     this.myRow        = row;
     this.myRightWall  = rightWall;
     this.myBottomWall = bottomWall;
     this.myMap        = map;
 }
        private Line setLineProperties(CellSide side, Line line)
        {
            line.StrokeThickness = 3;
            line.Stroke          = Brushes.Black;
            if (side.isHighlighted == true)
            {
                line.Stroke = Brushes.Red;
                return(line);
            }

            if (side.hasWall == 0)
            {
                line.Stroke          = Brushes.LightBlue;
                line.StrokeThickness = 1;
            }
            return(line);
        }
        private void calculateWall(int wall, int cell)
        {
            int[]    mapData    = this.getMapData(cell);
            int      startOfCol = mapData[0];
            int      endOfCol   = mapData[1];
            int      startOfRow = mapData[2];
            int      endOfRow   = mapData[3];
            CellSide rightSide  = this.getCells()[cell].myRightWall;
            CellSide bottomSide = this.getCells()[cell].myBottomWall;

            if (rightSide.hasWall == wall)
            {
                this.view.drawWall(endOfCol, startOfRow - 1, endOfCol, endOfRow + 1, rightSide);
            }
            if (bottomSide.hasWall == wall)
            {
                this.view.drawWall(endOfCol + 1, endOfRow, startOfCol - 1, endOfRow, bottomSide);
            }
        }
        public void drawWall(int endOfCol, int startOfRow, int end, int endOfRow, CellSide cellSide = null, bool border = false)
        {
            Line line = new Line();

            line.X1 = endOfCol;
            line.Y1 = startOfRow;
            line.X2 = end;
            line.Y2 = endOfRow;
            if (border)
            {
                line.Stroke          = Brushes.Black;
                line.StrokeThickness = 3;
            }
            else if (cellSide != null)
            {
                line = setLineProperties(cellSide, line);
            }
            line.IsHitTestVisible = false;
            pbxMap.Children.Add(line);
        }