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


C# EdgeShape.Set方法代码示例

本文整理汇总了C#中FarseerPhysics.Collision.Shapes.EdgeShape.Set方法的典型用法代码示例。如果您正苦于以下问题:C# EdgeShape.Set方法的具体用法?C# EdgeShape.Set怎么用?C# EdgeShape.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FarseerPhysics.Collision.Shapes.EdgeShape的用法示例。


在下文中一共展示了EdgeShape.Set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EdgeTest

        private EdgeTest()
        {
            {
                Body ground = BodyFactory.CreateBody(World);

                Vector2 v1 = new Vector2(-10.0f, 0.0f);
                Vector2 v2 = new Vector2(-7.0f, -2.0f);
                Vector2 v3 = new Vector2(-4.0f, 0.0f);
                Vector2 v4 = Vector2.Zero;
                Vector2 v5 = new Vector2(4.0f, 0.0f);
                Vector2 v6 = new Vector2(7.0f, 2.0f);
                Vector2 v7 = new Vector2(10.0f, 0.0f);

                EdgeShape shape = new EdgeShape(v1, v2);
                shape.HasVertex3 = true;
                shape.Vertex3 = v3;
                ground.CreateFixture(shape);

                shape.Set(v2, v3);
                shape.HasVertex0 = true;
                shape.HasVertex3 = true;
                shape.Vertex0 = v1;
                shape.Vertex3 = v4;
                ground.CreateFixture(shape);

                shape.Set(v3, v4);
                shape.HasVertex0 = true;
                shape.HasVertex3 = true;
                shape.Vertex0 = v2;
                shape.Vertex3 = v5;
                ground.CreateFixture(shape);

                shape.Set(v4, v5);
                shape.HasVertex0 = true;
                shape.HasVertex3 = true;
                shape.Vertex0 = v3;
                shape.Vertex3 = v6;
                ground.CreateFixture(shape);

                shape.Set(v5, v6);
                shape.HasVertex0 = true;
                shape.HasVertex3 = true;
                shape.Vertex0 = v4;
                shape.Vertex3 = v7;
                ground.CreateFixture(shape);

                shape.Set(v6, v7);
                shape.HasVertex0 = true;
                shape.Vertex0 = v5;
                ground.CreateFixture(shape);
            }

            {
                Body body = BodyFactory.CreateBody(World, new Vector2(-0.5f, 0.6f));
                body.BodyType = BodyType.Dynamic;
                body.SleepingAllowed = false;

                CircleShape shape = new CircleShape(0.5f, 1);
                _circleFixture = body.CreateFixture(shape);
            }

            {
                Body body = BodyFactory.CreateBody(World, new Vector2(1.0f, 0.6f));
                body.BodyType = BodyType.Dynamic;
                body.SleepingAllowed = false;

                PolygonShape shape = new PolygonShape(1);
                shape.Vertices = PolygonTools.CreateRectangle(0.5f, 0.5f);

                body.CreateFixture(shape);
            }
        }
开发者ID:RCGame,项目名称:FarseerPhysics,代码行数:72,代码来源:EdgeTest.cs


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