/** * Does this tile area intersect with another? * @param ta the other tile area to check against. * @return true if they intersect. */ public bool Intersects(ref TileArea ta) { if (ta.w == 0 || w == 0) { return(false); } if (ta.w == 0 || ta.h == 0 || w == 0 || h == 0) { throw new InvalidOperationException("neither the supplied or this area contains anything"); } uint left1 = Map.TileX(tile); uint top1 = Map.TileY(tile); uint right1 = left1 + w - 1; uint bottom1 = top1 + h - 1; uint left2 = Map.TileX(ta.tile); uint top2 = Map.TileY(ta.tile); uint right2 = left2 + ta.w - 1; uint bottom2 = top2 + ta.h - 1; return(!( left2 > right1 || right2 < left1 || top2 > bottom1 || bottom2 < top1 )); }
/// The current 'y' position in the rectangle. /** * Construct the iterator. * @param ta Area, i.e. begin point and width/height of to-be-iterated area. */ public OrthogonalTileIterator(TileArea ta) : base(ta.tile) { if (ta.w == 0 || ta.h == 0) { tile = TileConstants.INVALID_TILE; } w = ta.w; x = ta.w; y = ta.h; }
public TileMatrix() { area = new TileArea(TileConstants.INVALID_TILE, 0, 0); data = null; }