本文整理汇总了C#中Geom.SetBody方法的典型用法代码示例。如果您正苦于以下问题:C# Geom.SetBody方法的具体用法?C# Geom.SetBody怎么用?C# Geom.SetBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geom
的用法示例。
在下文中一共展示了Geom.SetBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sprite
//use this constructor when you want to add a sprite from the content pipeline
//sprites should have a pure magenta background for
//transparency
public sprite(theGame reference, String contentAssetName, float width, float height, float X, float Y)
{
asset = reference.Content.Load<Texture2D>(contentAssetName);
spriteOrigin = new Vector2(asset.Width / 2f, asset.Height / 2f);
this.X = X;
this.Y = Y;
this.width = width;
this.height = height;
rectangle = new Rectangle((int)this.X, (int)this.Y, (int)width, (int)height);
this.identity = identity;
this.reference = reference;
rectBody = BodyFactory.Instance.CreateRectangleBody(reference.ps, width, height, 1);//PHYSICS
rectBody.Position = new FarseerGames.FarseerPhysics.Mathematics.Vector2(this.X, this.Y);//PHYSICS
rectGeom = GeomFactory.Instance.CreateRectangleGeom(reference.ps,rectBody, this.width, this.height);//PHYSICS
rectGeom.SetBody(rectBody);
rectGeom.CollisionEnabled = true;
this.rectGeom.CollisionResponseEnabled = true;
this.rectGeom.CollisionCategories = CollisionCategory.All;
this.rectGeom.CollidesWith = CollisionCategory.All;
rectBody.Enabled = true;//PHYSICS
rectGeom.OnSeparation += OnSeperation;
rectGeom.OnCollision += OnCollision;
reference.ps.BroadPhaseCollider.OnBroadPhaseCollision += OnBroadPhaseCollision;
reference.ps.Add(rectBody);
reference.ps.Add(rectGeom);
}