public void Merge(IPartialGrid <TData> other) { foreach (var cell in other) { _data[cell.pos.row, cell.pos.col] = cell.data; } }
public bool DoesCollideWith(IPartialGrid <TData> other) { foreach (var cell in other) { if (IsPositionOccupied(cell.pos)) { return(true); } } return(false); }
public bool IsGridInBounds <T>(IPartialGrid <T> grid) where T : IEquatable <T> { foreach (var cell in grid) { if (cell.pos.row < 0 || cell.pos.row >= _rows || cell.pos.col < 0 || cell.pos.col >= _cols) { return(false); } } return(true); }
/// <summary> /// Send merge command to the view. Will add parameter grid to the existing view structure of specific grid type. /// Will transform grid based on injected IGridTransform. /// </summary> /// <param name="type"></param> /// <param name="grid"></param> public void DispatchMergeGrid(GridType type, IPartialGrid <CellDataModel> grid) { mergeGridInView.Dispatch(type, transform.GridToWorld(grid.pos), MapToViewData(grid)); }
public Vector3 GridWorldCentroid <T>(IPartialGrid <T> grid) where T : IEquatable <T> { return(GridToWorld((float)grid.pos.row + grid.rows / 2f, (float)grid.pos.col + grid.cols / 2f)); }
public IEnumerable <Vector3> TransformGridToWorldPoints <T>(IPartialGrid <T> grid) where T : IEquatable <T> { return(grid.Select(a => GridToWorld(a.pos))); }