Exemplo n.º 1
0
        public CollisionGrid(int[] data, int columns, int rows, int cellWidth, int cellHeight)
        {
            _data = new CollisionGridCell[data.Length];

            for (var y = 0; y < rows; y++)
            {
                for (var x = 0; x < columns; x++)
                {
                    var index = x + y * columns;
                    _data[index] = new CollisionGridCell(this, x, y, data[index]);
                }
            }

            Columns = columns;
            Rows = rows;
            CellWidth = cellWidth;
            CellHeight = cellHeight;
        }
Exemplo n.º 2
0
        public CollisionGrid(int[] data, int columns, int rows, int cellWidth, int cellHeight)
        {
            _data = new CollisionGridCell[data.Length];

            for (var y = 0; y < rows; y++)
            {
                for (var x = 0; x < columns; x++)
                {
                    var index = x + y * columns;
                    _data[index] = new CollisionGridCell(this, x, y, data[index]);
                }
            }

            Columns    = columns;
            Rows       = rows;
            CellWidth  = cellWidth;
            CellHeight = cellHeight;
        }