本文整理汇总了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);*/
}
示例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();
}