Esempio n. 1
0
        public static int TraceHex(LineTracerCallback callback)
        {
            ushort hx   = callback.Hx;
            ushort hy   = callback.Hy;
            int    dist = callback.Dist == 0 ? GetDistance(hx, hy, callback.Tx, callback.Ty) : callback.Dist;

            if (dist == 0)
            {
                dist = GetDistance(hx, hy, callback.Tx, callback.Ty);
            }
            LineTracer lt = new LineTracer(hx, hy, callback.Tx, callback.Ty,
                                           callback.MaxHx, callback.MaxHy, callback.Angle, false);

            for (int i = 0; i < dist; i++)
            {
                if (callback.Exec(hx, hy))
                {
                    return(i);
                }
                lt.GetNextHex(ref hx, ref hy);
            }
            return(dist);
        }
Esempio n. 2
0
 public static int TraceHex(LineTracerCallback callback)
 {
     ushort hx = callback.Hx;
     ushort hy = callback.Hy;
     int dist = callback.Dist == 0 ? GetDistance(hx, hy, callback.Tx, callback.Ty) : callback.Dist;
     if (dist == 0) dist = GetDistance(hx, hy, callback.Tx, callback.Ty);
     LineTracer lt = new LineTracer(hx, hy, callback.Tx, callback.Ty,
                         callback.MaxHx, callback.MaxHy, callback.Angle, false);
     for (int i = 0; i < dist; i++)
     {
         if (callback.Exec(hx, hy)) return i;
         lt.GetNextHex(ref hx, ref hy);
     }
     return dist;
 }