private VisualBrick[,] GetVisualsFilledWithColor(ConsoleColor color, int rows, int cols, char ch) { VisualBrick[,] bricks = new VisualBrick[rows, cols]; for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { bricks[r, c].color = color; bricks[r, c].ch = ch; } } return bricks; }
private VisualBrick[,] GenerateRandomTexture(VisualBrick[,] bricks, char ch) { int row = rnd.Next(0, bricks.GetLength(0)); int col = rnd.Next(0, bricks.GetLength(1)); if (rnd.Next(0, 4) != 0) // 20% chance for not generating random texture { return bricks; } bricks[row, col].ch = ch; return bricks; }
public bool isSolid; /// player can not pass through solid elements; #endregion Fields #region Constructors public VisualElement(VisualBrick[,] ElementMatrix, DangerousTerritory content, bool isSolid) { this.ElementMatrix = ElementMatrix; this.content = content; this.isSolid = isSolid; }
private void DrawBrick(VisualBrick brick, int row, int col) { Console.SetCursorPosition(col, row); Console.BackgroundColor = brick.color; Console.Write(brick.ch); }