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); }
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; })); }