public Field(int width, int height, int cellLength, Texture2D cell, int offset, int interval, GameOfLife main) { this.width = width; this.height = height; this.cellLength = cellLength; this.offset = offset; this.main = main; changedCells = new Queue<Cell>(); pq = new PseudoQueue<Cell>(); WidthInCells = width; HeightInCells = height; Interval = interval; Bounds = new Rectangle(offset, offset, width * cellLength, height * cellLength); CellTexture = cell; field = new Cell[width,height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { field[i, j] = new Cell(i * cellLength + offset, j * cellLength + offset, cellLength); } } }
public void RemoveCellFromChecked(Cell c) { pq.Remove(c); }
/// <summary> /// Adds a cell to be changed later. /// </summary> /// <param name="c"></param> public void AddCellToChanged(Cell c) { changedCells.Enqueue(c); }
public void AddCellToChecked(Cell c) { pq.Enqueue(c); }
/// <summary > /// Add a cell into the row /// </summary> /// <param name="cell"></param> public void AddCell(Cell cell) { Cells.Add(cell); }