本文整理汇总了C#中FarseerPhysics.Dynamics.Body.AttachCircle方法的典型用法代码示例。如果您正苦于以下问题:C# Body.AttachCircle方法的具体用法?C# Body.AttachCircle怎么用?C# Body.AttachCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Dynamics.Body
的用法示例。
在下文中一共展示了Body.AttachCircle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SteerDude
public SteerDude(Team team, Vector2 position, float radius)
{
Team = team;
//body
Body = Add(new Body(Physic.World)
{
BodyType = BodyType.Dynamic,
IsBullet = true,
Position = new Vector2(position.X, position.Y)
});
Body.AttachCircle(radius, 1f);
// sprite
var sprite = Add(new Sprite(DataPack.Textures.Circle)
{
Size = radius * 2,
Color = Team.Color
});
this.Attach(Body, sprite);
// vehicle
Vehicle = Add(new FarseerVehicle(Body)
{
MaxForce = 100,
MaxSpeed = 5f,
Radius = radius
});
team.Vehicles.Add(Vehicle);
}
示例2: GroundConstraint
public GroundConstraint(Body body, Fixture bodyFixture, SurfaceMovementControl surfaceMovementControl)
{
_body = body;
_surfaceMovementControl = surfaceMovementControl;
Add(bodyFixture.CreateContactHandler(HexPhysicTypes.Ground, EnterGroundContact, ExitGroundContact));
// sensor
var sensor = _body.AttachCircle(10f, 0);
sensor.IsSensor = true;
sensor.SetCollisionType(HexPhysicTypes.GroundSensor);
_closeHexList = Add(new FixtureContactList(sensor));
// ground constraint
_groundConstraintUpdate = new UpdateComponent(UpdateGroundConstraint, UpdateTime.Sim);
Add(_groundConstraintUpdate);
// state
Add(new StateRecorder("groundConstraint",
state => { },
state =>
{
_isOnGround = false;
_currentHex = null;
}));
}