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


C# Vertices.ToList方法代码示例

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


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

示例1: GenerateQuad

        private void GenerateQuad(GiftWrapQuad quad)
        {
            PhysicsComponent physics = Scene.ComponentManager.GetComponent<PhysicsComponent>();

            Vertices vets = new Vertices();
            vets.Add(quad.TopLeft);
            vets.Add(quad.TopRight);
            vets.Add(quad.BottomRight);
            vets.Add(quad.BottomLeft);

            List<Vector2> physicsVerts = new List<Vector2>();
            vets.ToList<Vector2>().ForEach(s => physicsVerts.Add(ConvertUnits.ToSimUnits(s)));
            /*
            List<Vertices> vers = EarclipDecomposer.ConvexPartition(new Vertices(physicsVerts));

            Body body = BodyFactory.CreateCompoundPolygon(physics.World, vers, 1);
            body.BodyType = BodyType.Static;
            body.IsSensor = true;

            body.OnCollision += (a, b, c) =>
                {
                    quad._collision++;
                    return true;
                };

            body.OnSeparation += (a, b) =>
                {
                    quad._collision--;
                };
            //body.CollisionCategories = Category.Cat28;
            //body.CollidesWith = Category.Cat27;

            VertexPositionTexture[] currentQuad = new VertexPositionTexture[6];

            float topDistance = Vector2.Distance(quad.TopLeft, quad.TopRight) / 100;
            float bottomDistance = Vector2.Distance(quad.BottomLeft, quad.BottomRight) / 100;

            currentQuad[0].Position = new Vector3(quad.TopLeft, 0);
            currentQuad[0].TextureCoordinate = new Vector2(0, 0);

            currentQuad[1].Position = new Vector3(quad.TopRight, 0);
            currentQuad[1].TextureCoordinate = new Vector2(topDistance, 0);

            currentQuad[2].Position = new Vector3(quad.BottomRight, 0);
            currentQuad[2].TextureCoordinate = new Vector2(bottomDistance, 1);

            currentQuad[3].Position = new Vector3(quad.TopLeft, 0);
            currentQuad[3].TextureCoordinate = new Vector2(0, 0);

            currentQuad[4].Position = new Vector3(quad.BottomRight, 0);
            currentQuad[4].TextureCoordinate = new Vector2(bottomDistance, 1);

            currentQuad[5].Position = new Vector3(quad.BottomLeft, 0);
            currentQuad[5].TextureCoordinate = new Vector2(0, 1);

            _renderVerticies.Add(quad, currentQuad);*/
        }
开发者ID:lucas-jones,项目名称:MilkShake-old,代码行数:57,代码来源:TextureGiftWrapRenderer.cs

示例2: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            DebugView.DrawString(50, TextLine, "Press: left mouse button to remove at mouse position.");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Press: (A) to decrease the removal radius, (S) to increase it.");
            TextLine += 15;
            // Fighting against float decimals
            float radiusnumber = (float)((int)(Radius * 10)) / 10;
            DebugView.DrawString(50, TextLine, "Radius: " + radiusnumber);

            Color color = new Color(0.4f, 0.7f, 0.8f);

            //Transform shape to mouseposition and then draw
            Vertices tempshape = new Vertices(_clipCircle);
            tempshape.Translate(ref _mousePos);
            DebugView.BeginCustomDraw();
            var ts = tempshape.ToList().Cast<CCVector2>();
			DebugView.DrawPolygon(ts.ToArray(), _clipCircle.Count, color);
            DebugView.EndCustomDraw();
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:22,代码来源:DestructibleTerrainYuPengTest.cs


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