예제 #1
0
        /// <summary>
        /// 将unity坐标转化为hex坐标
        /// </summary>
        /// <returns></returns>
        public HexCoordinate StandardToHexCoordiante()
        {
            HexCoordinate hex = new HexCoordinate();

            hex.Z = ( int )(Math.Round(Z / 1.5f));
            hex.X = ( int )(Math.Round((X - hex.Z * (RADIUS / 2)) / RADIUS));
            return(hex);
        }
예제 #2
0
 public int HexDistance(HexCoordinate a, HexCoordinate b)
 {
     return((a.X - b.X) * (a.X - b.X) + (a.Z - b.Z) * (a.Z - b.Z));
 }