本文整理汇总了C#中RectangleF.intersects方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleF.intersects方法的具体用法?C# RectangleF.intersects怎么用?C# RectangleF.intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RectangleF
的用法示例。
在下文中一共展示了RectangleF.intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: aabbBroadphase
/// <summary>
/// returns all objects in cells that the bounding box intersects
/// </summary>
/// <returns>The neighbors.</returns>
/// <param name="bounds">Bounds.</param>
/// <param name="layerMask">Layer mask.</param>
public HashSet<Collider> aabbBroadphase( ref RectangleF bounds, Collider excludeCollider, int layerMask )
{
_tempHashset.Clear();
var p1 = cellCoords( bounds.x, bounds.y );
var p2 = cellCoords( bounds.right, bounds.bottom );
for( var x = p1.X; x <= p2.X; x++ )
{
for( var y = p1.Y; y <= p2.Y; y++ )
{
var cell = cellAtPosition( x, y );
if( cell == null )
continue;
// we have a cell. loop through and fetch all the Colliders
for( var i = 0; i < cell.Count; i++ )
{
var collider = cell[i];
// skip this collider if it is our excludeCollider or if it doesnt match our layerMask
if( collider == excludeCollider || !Flags.isFlagSet( layerMask, collider.physicsLayer ) )
continue;
if( bounds.intersects( collider.bounds ) )
_tempHashset.Add( collider );
}
}
}
return _tempHashset;
}