示例#1
0
文件: SteerDude.cs 项目: hgrandry/Mgx
        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
0
文件: Team.cs 项目: hgrandry/Mgx
 public void CreateMember(Team otherTeam)
 {
     var actor = Add(new SteerDude(this, _area.ScaleFromCenter(.2f).GetRandomPoint(), .3f));
     actor.Add(new MemberAI(actor.Vehicle, actor.Team, otherTeam));
 }