private IReadOnlyList <ICellInternal> CreateCells() { return(Enumerable.Range(1, Size) .SelectMany(row => Enumerable.Range(1, Size).Select(col => _cellFactory.CreateCell(row, col))) .Cast <ICellInternal>() .ToList()); }
public virtual void Fill() { if (!SettingsHelper.CheckValidity(Height, Width, MinesCount, out string reason)) { throw new Exception(reason); } FlagsCount = 0; notMinedCellsCount = Height * Width - MinesCount; openedCellsCount = 0; Cells = new List <List <ICell> >(Height); for (int y = 0; y < Height; ++y) { List <ICell> row = new List <ICell>(Width); for (int x = 0; x < Width; ++x) { ICell cell = cellFactory.CreateCell(this, x, y); cell.OnStateChanged += Cell_OnStateChanged; row.Add(cell); } Cells.Add(row); } MineAField(); OnFilled?.Invoke(this, EventArgs.Empty); State = FieldState.NotStarted; }
public IPlantCell CreateCell(PlantCellType type, Vector3 center, float radius, float height) { var geometry = CreateCellGeometry(center, radius, height); var vacuole = new Vacuole(); var wall = new CellWall(); return(cellFactory.CreateCell(type, geometry, vacuole, wall)); }
private IPlantCell CreateCell(Vector3 center, Vector3 direction) { var geometry = CreateCellGeometry(center, direction); var vacuole = new Vacuole(); var cellWall = new CellWall(); return(cellCreator.CreateCell(PlantCellType.Parenchyma, geometry, vacuole, cellWall)); }
private IEnumerable <IPlantCell> CreateNodeCells(IPlantPartDescriptor descriptor) { var top = descriptor.Top; var bottom = new Vector3(top.X, top.Y, top.Z); var polygon = new Vector2[0]; var face = new Face(polygon); var geo = new CellGeometry(top, bottom, face); var cell = cellFactory.CreateCell(PlantCellType.Parenchyma, geo, new Vacuole(), new CellWall()); return(new [] { cell }); }
private IPlantCell CreatePlantCell(PlantCellType type, ICellGeometry geometry, IVacuole vacuole, ICellWall cellWall) { return(cellFactory.CreateCell(type, geometry, vacuole, cellWall)); }