Example #1
0
        /// <summary>
        /// Makes an edge grid for this grid.
        /// </summary>
        public IGrid <TNewCell, FlatRhombPoint> MakeEdgeGrid <TNewCell>()
        {
            var edges   = this.SelectMany(x => x.GetEdges());
            var storage = FlatRhombGrid <TNewCell> .CalculateStorage(edges);

            var offset = FlatRhombGrid <TNewCell> .GridPointFromArrayPoint(storage.offset);

            var oddPoint = new FlatHexPoint(
                GLMathf.FloorMod(offset.X, 2),
                GLMathf.FloorMod(offset.Y, 2));

            var evenPoint = offset.Subtract(oddPoint);

            return(new FlatRhombGrid <TNewCell>(storage.dimensions.X + 2, storage.dimensions.Y + 2, IsInsideEdgeGrid, evenPoint));
        }
Example #2
0
 protected override FlatHexPoint GridPointFromArrayPoint(ArrayPoint point)
 {
     return(FlatRhombGrid <TCell> .GridPointFromArrayPoint(point));
 }