当前位置: 首页>>代码示例>>C#>>正文


C# World.AddController方法代码示例

本文整理汇总了C#中FarseerPhysics.Dynamics.World.AddController方法的典型用法代码示例。如果您正苦于以下问题:C# World.AddController方法的具体用法?C# World.AddController怎么用?C# World.AddController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FarseerPhysics.Dynamics.World的用法示例。


在下文中一共展示了World.AddController方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Water

 /// <summary>
 /// 
 /// </summary>
 /// <param name="game"></param>
 /// <param name="world"></param>
 /// <param name="position">The top left corner</param>
 /// <param name="width">The width of the container</param>
 /// <param name="height">The height of a container</param>
 public Water(Game game, SpriteBatch spriteBatch, World world, Vector2 position, float width, float height)
 {
     sprite = new LoopSpriteAnimator(game, spriteBatch, game.Content.Load<Texture2D>("Images/Sprites/gb"), 200, 6, 1, 6);
     position = new Vector2(position.X + width/2,position.Y + height/2);
     texture = new TexturedGameEntity(game, position,0,"Images/water",0.3f);
     var container = new AABB(ConvertUnits.ToSimUnits(position),ConvertUnits.ToSimUnits(width),ConvertUnits.ToSimUnits(height));
     var buoyancy = new BuoyancyController(container, 1.1f, 2, 1, world.Gravity);
     world.AddController(buoyancy);
 }
开发者ID:dreasgrech,项目名称:FPE3Sandbox,代码行数:17,代码来源:Water.cs

示例2: Water

 public Water(World w, int index, Vector2 pos, string width, string height)
     : base()
 {
     this.world = w;
     this.Index = index;
     this.width = float.Parse(width);
     this.height = float.Parse(height);
     this.Position = pos;
     this.Container = new AABB((pos - new Vector2(this.width / 2, this.height / 2)) * MainGame.PIXEL_TO_METER, (pos + new Vector2(this.width / 2, this.height / 2)) * MainGame.PIXEL_TO_METER);
     BuoyancyController buoyancy = new BuoyancyController(Container, 1.0f, 0.3f, 0.3f, w.Gravity);
     buoyancy.AddDisabledCategory(Category.Cat1);
     w.AddController(buoyancy);
     this.texture = MainGame.blank;
 }
开发者ID:TadCordle,项目名称:MrGuyXNA,代码行数:14,代码来源:Water.cs

示例3: WheelSet

        public WheelSet(World world, Car car, Vector2 position, float orientation)
        {
            Matrix rotation = Matrix.CreateRotationZ(orientation);

            LeftFront = new RevoluteWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_LF, rotation), orientation);
            RightFront = new RevoluteWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_RF, rotation), orientation);
            LeftRear = new FixedWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_LR, rotation), Car.WHEEL_POS_LR, orientation);
            RightRear = new FixedWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_RR, rotation), Car.WHEEL_POS_RR, orientation);

            Controller = new TensorDampingController();
            Controller.SetAxisAligned(0, 100);
            Controller.AddBody(LeftFront.Body);
            Controller.AddBody(RightFront.Body);
            Controller.AddBody(LeftRear.Body);
            Controller.AddBody(RightRear.Body);

            world.AddController(Controller);
        }
开发者ID:jgera,项目名称:AutonomousCar,代码行数:18,代码来源:Car.cs

示例4: Initialize

        /// <summary>
        /// Perform any initialization necessary before running the game.  This
        /// includes both (preliminary) model and view creation.
        /// </summary>
        protected override void Initialize()
        {
            canvas.Initialize(this);
                canvas.Scale = scale * Vector2.One;

                world = new World(new Vector2(0,GRAVITY));

                world.ContactManager.BeginContact += ContactStarted;
                world.ContactManager.EndContact += ContactEnded;

                canvas.LoadContent(content);

                ribbon_segment = canvas.GetTexture("ribbon_segment");
                /*List<Vector2> path = new List<Vector2>();
                path.Add(new Vector2(100, 100));
                path.Add(new Vector2(500, 100));*/
                //ribbon = new RibbonObject(world, ribbon_segment, new Vector2(100,100), ribbon_segment.Width, path);
                seamstress = new SeamstressObject();

                seamstressController = new SeamstressForceController(seamstress);
                world.AddController(seamstressController);

                /*ribbonController = new RibbonForceController(ribbon);
                world.AddController(ribbonController);*/

                objects = new List<Object>();
                //objects.Add(ribbon);
                objects.Add(seamstress);

                base.Initialize();
        }
开发者ID:kjin,项目名称:ribbon_gameplay,代码行数:35,代码来源:GameEngine.cs


注:本文中的FarseerPhysics.Dynamics.World.AddController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。