예제 #1
0
 public BoardLocation( IntVector2 location, IntVector2 offset )
 {
     this.location = location.Clone();
     int offx = offset.x;
     int offy = offset.y;
     int locx = location.x;
     int locy = location.y;
     while ( offx > 1000 )
     {
         locx++;
         offx -= Constants.BoardCellDiameter;
     }
     while ( offx <= -1000 )
     {
         locx--;
         offx += Constants.BoardCellDiameter;
     }
     while ( offy > 1000 )
     {
         locy++;
         offy -= Constants.BoardCellDiameter;
     }
     while ( offy <= -1000 )
     {
         locy--;
         offy += Constants.BoardCellDiameter;
     }
     this.location = new IntVector2( locx, locy );
     this.offset = new IntVector2( offx, offy );
 }
예제 #2
0
 public static int OrthogonalDistance( IntVector2 a, IntVector2 b )
 {
     return Math.Abs( a.x - b.x ) + Math.Abs( a.y - b.y );
 }