/** * This creates a shape described by a shape of the base point shape op. * Typicaly usage: * \code * [ShapeMethod] * public FlatTriShapeInfo<TCell> SomeShape(...) * { * return ShapeFromBase(PointyHexGrid<TCell>.BeginShape().SomeShape(...)); * } * \endcode */ public FlatTriShapeInfo <TCell> ShapeFromBase(PointyHexShapeInfo <TCell> baseShapeInfo) { ShapeStorageInfo <PointyHexPoint> storageInfo = baseShapeInfo.ShapeStorageStorageInfo; var storageRect = storageInfo.storageRect; Func <FlatTriPoint, bool> isInside = x => storageInfo.contains(x.BasePoint); var shapeInfo = MakeShapeStorageInfo <FlatTriPoint>(storageRect, isInside); return(new FlatTriShapeInfo <TCell>(shapeInfo)); }
public static bool __CompilerHint2__PointyHex__MeshTileCell() { //Ensures abstract super classes for base grids gets created var grid = new PointyHexGrid <MeshTileCell>(1, 1, p => p == PointyHexPoint.Zero, x => x, x => x, new List <PointyHexPoint>()); //Ensures shape infpo classes get created var shapeStorageInfo = new ShapeStorageInfo <PointyHexPoint>(new IntRect(), p => true); var shapeInfo = new PointyHexShapeInfo <MeshTileCell>(shapeStorageInfo); return(grid[grid.First()] == null || shapeInfo.Translate(PointyHexPoint.Zero) != null); }
public static bool __CompilerHint__PointyHex__MeshTileCell() { var grid = new PointyHexGrid <MeshTileCell[]>(1, 1); foreach (var point in grid) { grid[point] = new MeshTileCell[1]; } var shapeStorageInfo = new ShapeStorageInfo <PointyHexPoint>(new IntRect(), p => true); var shapeInfo = new PointyHexShapeInfo <MeshTileCell>(shapeStorageInfo); return(grid[grid.First()][0] == null || shapeInfo.Translate(PointyHexPoint.Zero) != null); }
/** * Call this method if you use a PointyHexGrid. * Replace the type __CellType to whatever type you have in your grid. * * You can call the method anywhere in your code. * * if(!__CompilerHint__PointyHex()) return; * * This methods always returns true. * * @since 1.6 */ public static bool __CompilerHint__PointyHex() { //Ensures abstract super classes for base grids gets created var grid = new PointyHexGrid <__CellType[]>(1, 1); foreach (var point in grid) { grid[point] = new __CellType[1]; } //Ensures shape infpo classes get created var shapeStorageInfo = new ShapeStorageInfo <PointyHexPoint>(new IntRect(), p => true); var shapeInfo = new PointyHexShapeInfo <__CellType>(shapeStorageInfo); return(grid[grid.First()][0] == null || shapeInfo.Translate(PointyHexPoint.Zero) != null); }