Ejemplo n.º 1
0
        /// <summary>Return a new instance of <c>Hexgrid</c>.</summary>
        protected TransposableHexgrid(HexSize gridSize, float scale, HexSize margin)
        {
            GridSize = gridSize;
            Scale    = scale;
            Margin   = margin;

            GridSizeF  = GridSize.Scale(Scale);
            HexCorners = new List <HexPoint>()
            {
                new HexPoint(GridSize.Width * 1 / 3, 0),
                new HexPoint(GridSize.Width * 3 / 3, 0),
                new HexPoint(GridSize.Width * 4 / 3, GridSize.Height / 2),
                new HexPoint(GridSize.Width * 3 / 3, GridSize.Height),
                new HexPoint(GridSize.Width * 1 / 3, GridSize.Height),
                new HexPoint(0, GridSize.Height / 2),
                new HexPoint(GridSize.Width * 1 / 3, 0)
            }.AsReadOnly();
        }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public virtual HexSize   GetSize(HexSize mapSizePixels, float mapScale)
 {
     return(HexSize.Ceiling(mapSizePixels.Scale(mapScale)));
 }