예제 #1
0
        /// <summary>
        /// Returns the center pixel of a hexagon
        /// </summary>
        public Vector2 HexToPixel()
        {
            HexagonAxial axial = ToAxial();
            Vector2      pixel = axial.HexToPixel();

            return(pixel);
        }
예제 #2
0
        public HexagonAxial ToAxial()
        {
            float q     = X;
            float r     = Z;
            var   axial = new HexagonAxial(q, r);

            return(axial);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        public bool IncludesPixel(Vector2 pixel)
        {
            //float q = pixel.X * Constants.TWO_THIRDS / Constants.HALF_HEX_WIDTH;
            //double r = (-pixel.X / 3.0f + Constants.HALF * pixel.Y) / Constants.HALF_HEX_HEIGHT;
            //var axial = new HexagonAxial(q, (float)r);
            HexagonAxial axial = pixel.PixelToHex();

            axial = axial.Round();

            return(axial.Q == Q && axial.R == R);
        }