public void EnqueueForRendering(IRenderable unit) { char[,] unitImage = unit.GetImage(); int imageRows = unitImage.GetLength(0); int imageCols = unitImage.GetLength(1); MatrixCoords unitTopLeft = unit.GetTopLeft(); int lastRow = Math.Min(unitTopLeft.Row + imageRows, Rows); int lastCol = Math.Min(unitTopLeft.Col + imageCols, Cols); for (int row = unit.GetTopLeft().Row; row < lastRow; row++) { for (int col = unit.GetTopLeft().Col; col < lastCol; col++) { if (row >= 0 && row < Rows && col >= 0 && col < Cols) { matrixToPrint[row, col] = unitImage[row - unit.GetTopLeft().Row, col - unit.GetTopLeft().Col]; } } } }
// ///1 - right 2 down 3 - left 4 up public void Move(MatrixCoords newPosition) { // TODO : implement the function }
public override bool Equals(object obj) { MatrixCoords objAsMatrixCoords = obj as MatrixCoords; return(objAsMatrixCoords.Row == this.Row && objAsMatrixCoords.Col == this.Col); }