Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Start()
- {
- //Add your code here
- int topX = 0;
- int topY = 0;
- int width = 2;
- int height = 5;
- int triangleSize = ((width * height)/2);
- string color1 = "black";
- string color2 = "red";
- int columnCount = 8;
- int rowCount = 8;
- //Draw Checkerboard
- //Draw Row
- //Call function for draw row using the variable above AND a new variable for the column size
- //dont use int becuase you already did that. you dont do it whne calling no something
- DrawRow(topX, topY, triangleSize, columnCount, color1, color2);
- ;
- DrawCheckerBoard(topX, topY, triangleSize, columnCount, rowCount, color1, color2);
- }
- public void DrawCheckerBoard(int topX, int topY, int squareSize, int columns, int rows, string color1, string color2)
- {
- for (int row = 0; row < rows; row++)
- {
- if (row % 2 == 0)
- {
- DrawRow(topX, topY + squareSize * row, squareSize, columns, color1, color2);
- }
- else
- {
- DrawRow(topX, topY + squareSize * row, squareSize, columns, color2, color1);
- }
- }
- }
- public void DrawRow(int topX, int topY, int triangleSize, int columns, string color1, string color2)
- {
- string color = color1;
- for (int column = 0; column < columns; column++)
- {
- if (column % 2 == 0)
- {
- color = color1;
- }
- else
- {
- color = color2;
- }
- //shorthand methos of same thing above for DrawRow
- //string bonusColor = column % 2 == 0 ? color1 : color2;
- //DrawTriangle(topX + triangleSize * column, topY, triangleSize, color);
- //DrawSquare(topX + squareSize * column, topY, squareSize, color);
- }
- }
- /// <summary>
- /// This function draws a black square using drawer.DrawRectangle
- /// </summary>
- public void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3, string color)
- {
- drawer.DrawTriangle(x1, y1, x2, y2, x3, y3, color);
- }
- //public void DrawSquare(int topX, int topY, int size, string color)
- //{
- // drawer.DrawRectangle(topX, topY, size, size, color);
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement