本文整理汇总了C#中FloatRect.Intersects方法的典型用法代码示例。如果您正苦于以下问题:C# FloatRect.Intersects方法的具体用法?C# FloatRect.Intersects怎么用?C# FloatRect.Intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect.Intersects方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RectRectCollision
public static bool RectRectCollision(FloatRect r1, FloatRect r2)
{
return r1.Intersects(r2);
}
示例2: RectPointCollision
public static bool RectPointCollision(FloatRect rect, Vector2f pt)
{
return rect.Intersects(new FloatRect(pt.X, pt.Y, 1.0f, 1.0f));
}
示例3: PlaceFree
public bool PlaceFree(FloatRect r, CollisionCondition cond = null)
{
var tileSize = GameOptions.TileSize;
var minX = Math.Max(0, ((int)r.Left / tileSize) - 1);
var minY = Math.Max(0, ((int)r.Top / tileSize) - 1);
var maxX = Math.Min(Width, minX + ((int)r.Width / tileSize) + 3);
var maxY = Math.Min(Height, minY + ((int)r.Height / tileSize) + 3);
var testRect = new FloatRect(0, 0, tileSize, tileSize);
for (var yy = minY; yy < maxY; yy++)
{
for (var xx = minX; xx < maxX; xx++)
{
if (!tiles[xx, yy].Solid)
continue;
testRect.Left = xx * tileSize;
testRect.Top = yy * tileSize;
if (!r.Intersects(testRect))
continue;
if (cond == null)
return false;
if (cond(tiles[xx, yy], testRect, r))
return false;
}
}
return true;
}
示例4: testPoint
public bool testPoint(Vector2f point)
{
FloatRect pointRect = new FloatRect(point.X, point.Y, 1, 1);
if (pointRect.Intersects(_buttonShape.GetGlobalBounds()))
{
return true;
}
if (pointRect.Intersects(_firstLetter.GetGlobalBounds()))
{
return true;
}
if (pointRect.Intersects(_word.GetGlobalBounds()))
{
return true;
}
return false;
}
示例5: CheckCollisionMove
private bool CheckCollisionMove(FloatRect targetBounds, FloatRect collisionBounds)
{
return collisionBounds.Intersects(targetBounds);
}
示例6: characterPaneTestPoint
private bool characterPaneTestPoint(Vector2f point, int slot)
{
FloatRect pointRect = new FloatRect(point.X, point.Y, 1f, 1f);
FloatRect highlightRect = _characterButtonHighlights[slot].GetGlobalBounds();
FloatRect slotRect = new FloatRect(highlightRect.Left + 8f, highlightRect.Top + 8f, highlightRect.Width - 16f, highlightRect.Height - 16f);
return pointRect.Intersects(slotRect);
}