当前位置: 首页>>代码示例>>C#>>正文


C# FloatRect.Intersects方法代码示例

本文整理汇总了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);
 }
开发者ID:JimmJamm,项目名称:SqEng,代码行数:4,代码来源:Helpers.cs

示例2: RectPointCollision

 public static bool RectPointCollision(FloatRect rect, Vector2f pt)
 {
     return rect.Intersects(new FloatRect(pt.X, pt.Y, 1.0f, 1.0f));
 }
开发者ID:JimmJamm,项目名称:SqEng,代码行数:4,代码来源:Helpers.cs

示例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;
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:31,代码来源:TileMap.cs

示例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;
        }
开发者ID:klutch,项目名称:Loderpit,代码行数:21,代码来源:BigLabeledButtonComponent.cs

示例5: CheckCollisionMove

 private bool CheckCollisionMove(FloatRect targetBounds, FloatRect collisionBounds)
 {
     return collisionBounds.Intersects(targetBounds);
 }
开发者ID:Catvert,项目名称:MaryoTheReturn,代码行数:4,代码来源:PhysicsBody.cs

示例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);
        }
开发者ID:klutch,项目名称:Loderpit,代码行数:8,代码来源:SkillsScreen.cs


注:本文中的FloatRect.Intersects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。