Example #1
0
 public static void PrecalcStep()
 {
     for (var j = 0; j < 64; j++)
     {
         var f = new StepFromPosition(4);
         var x = j >> 3;
         var y = j & 7;
         for (var i = 0; i < 4; i++)
         {
             var nx = x + _dx[i];
             var ny = y + _dy[i];
             Ray last = null;
             if (nx >= 0 && nx < 8 && ny >= 0 && ny < 8)
             {
                 var s = new Step(x, y, nx, ny);
                 var r = new Ray(s);
                 f.Rays[i] = r;
                 last = r;
                 f.Attack.Add((nx << 3) + ny, i);
             }
             nx += _dx[i];
             ny += _dy[i];
             while (nx >= 0 && nx < 8 && ny >= 0 && ny < 8)
             {
                 var s = new Step(x, y, nx, ny);
                 f.Attack.Add((nx << 3) + ny, i);
                 var n = new Ray(s);
                 last.NextRay = n;
                 last = n;
                 nx += _dx[i];
                 ny += _dy[i];
             }
         }
         pSteps[j] = f;
     }
 }
Example #2
0
 public Ray(Step s, Ray next = null)
 {
     step = s;
     NextRay = next;
 }