Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
 public void RemoveCellFromChecked(Cell c)
 {
     pq.Remove(c);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a cell to be changed later.
 /// </summary>
 /// <param name="c"></param>
 public void AddCellToChanged(Cell c)
 {
     changedCells.Enqueue(c);
 }
Ejemplo n.º 4
0
 public void AddCellToChecked(Cell c)
 {
     pq.Enqueue(c);
 }
Ejemplo n.º 5
0
 /// <summary    >
 /// Add a cell into the row
 /// </summary>
 /// <param name="cell"></param>
 public void AddCell(Cell cell)
 {
     Cells.Add(cell);
 }