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


C# BodyType类代码示例

本文整理汇总了C#中BodyType的典型用法代码示例。如果您正苦于以下问题:C# BodyType类的具体用法?C# BodyType怎么用?C# BodyType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GameCharacter

 public GameCharacter(Game game, World world, Vector2 position, Vector2 size, SpriteAnimation animation, BodyType bodyType)
     : base(game, world, position, size, animation, bodyType)
 {
     // Don't allow characters to rotate
     this.body.FixedRotation = true;
     this.jumpState = 0;
 }
开发者ID:askjervold,项目名称:limak,代码行数:7,代码来源:GameCharacter.cs

示例2: HazardBox

        public HazardBox( CubeGame game,
                          World world,
                          RectangleF rec,
                          BodyType bodyType = BodyType.Static,
                          float density = 1,
                          Category categories = Constants.Categories.DEFAULT,
                          Category killCategories = Constants.Categories.ACTORS )
            : base(game, world, rec.Center.ToUnits(), 0, new HazardBoxMaker( rec.Width, rec.Height ))
        {
            mWidth = rec.Width;
            mHeight = rec.Height;

            Fixture box = FixtureFactory.AttachRectangle(
                    mWidth.ToUnits(),
                    mHeight.ToUnits(),
                    density,
                    Vector2.Zero,
                    Body,
                    new Flat() );

            Fixture killBox = box.CloneOnto( Body );
            killBox.IsSensor = true;
            killBox.UserData = new Hazard( "killbox" );

            Body.BodyType = bodyType;
            Body.CollisionCategories = categories;

            killBox.CollidesWith = killCategories;
            box.CollidesWith ^= killCategories;
        }
开发者ID:theLOLflashlight,项目名称:CyberCube,代码行数:30,代码来源:HazardBox.cs

示例3: Quarterpipe

        public Quarterpipe( CubeGame game,
                            World world,
                            float radius,
                            Vector2 position,
                            Type type,
                            BodyType bodyType = BodyType.Static,
                            float density = 1,
                            Category categories = Constants.Categories.DEFAULT )
            : base(game, world, position.ToUnits(), AngleFromType( type ), new QuarterpipeMaker( radius ))
        {
            mRadius = radius;

            FixtureFactory.AttachChainShape(
                MakeArc( 100, radius.ToUnits(), 0 ),
                Body,
                new Concave() );

            var fixtureList = FixtureFactory.AttachCompoundPolygon(
                Triangulate.ConvexPartition(
                    MakeArc( 10, radius.ToUnits(), 0 ),
                    TriangulationAlgorithm.Earclip ),
                density,
                Body );

            foreach ( var f in fixtureList )
                f.CollidesWith = Category.None;

            Body.BodyType = bodyType;
            Body.CollisionCategories = categories;

            Initialize();
        }
开发者ID:theLOLflashlight,项目名称:CyberCube,代码行数:32,代码来源:Quaterpipe.cs

示例4: CreateCompoundPolygon

 public static Body CreateCompoundPolygon(World world, List<Vertices> list, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null)
 {
     //We create a single body
     Body polygonBody = CreateBody(world, position, rotation, bodyType);
     FixtureFactory.AttachCompoundPolygon(list, density, polygonBody, userData);
     return polygonBody;
 }
开发者ID:runegri,项目名称:NDC2014,代码行数:7,代码来源:BodyFactory.cs

示例5: AirlinerPassengerType

 public AirlinerPassengerType(Manufacturer manufacturer, string name,string family, int seating, int cockpitcrew, int cabincrew, double speed, long range, double wingspan, double length, double consumption, long price, int maxAirlinerClasses, long minRunwaylength, long fuelcapacity, BodyType body, TypeRange rangeType, EngineType engine, Period<DateTime> produced, int prodRate, Boolean standardType = true)
     : base(manufacturer,TypeOfAirliner.Passenger,name,family,cockpitcrew,speed,range,wingspan,length,consumption,price,minRunwaylength,fuelcapacity,body,rangeType,engine,produced, prodRate,standardType)
 {
     this.MaxSeatingCapacity = seating;
     this.CabinCrew = cabincrew;
     this.MaxAirlinerClasses = maxAirlinerClasses;
 }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:7,代码来源:AirlinerType.cs

示例6: EvenlyDistributeShapesAlongPath

        /// <summary>
        /// Duplicates the given Body along the given path for approximatly the given copies.
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="path">The path.</param>
        /// <param name="shapes">The shapes.</param>
        /// <param name="type">The type.</param>
        /// <param name="copies">The copies.</param>
        /// <param name="userData"></param>
        /// <returns></returns>
        public static List<Body> EvenlyDistributeShapesAlongPath(World world, Path path, IEnumerable<Shape> shapes, BodyType type, int copies, object userData = null)
        {
            List<Vector3> centers = path.SubdivideEvenly(copies);
            List<Body> bodyList = new List<Body>();

            for (int i = 0; i < centers.Count; i++)
            {
                Body b = new Body(world);

                // copy the type from original body
                b.BodyType = type;
                b.Position = new Vector2(centers[i].X, centers[i].Y);
                b.Rotation = centers[i].Z;
                b.UserData = userData;

                foreach (Shape shape in shapes)
                {
                    b.CreateFixture(shape);
                }

                bodyList.Add(b);
            }

            return bodyList;
        }
开发者ID:Woktopus,项目名称:Gamejam_lib,代码行数:35,代码来源:PathManager.cs

示例7: createPolygon

			public static Body createPolygon( World world, Vertices vertices, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null )
			{
				for( var i = 0; i < vertices.Count; i++ )
					vertices[i] *= FSConvert.displayToSim;

				return FarseerPhysics.Factories.BodyFactory.CreatePolygon( world, vertices, density, FSConvert.toSimUnits( position ), rotation, bodyType, userData );
			}
开发者ID:prime31,项目名称:Nez,代码行数:7,代码来源:BodyFactory.cs

示例8: PhysicsGameEntity

 /// <summary>
 /// Constructs a FPE Body from the given list of vertices and density
 /// </summary>
 /// <param name="game"></param>
 /// <param name="world"></param>
 /// <param name="vertices">The collection of vertices in display units (pixels)</param>
 /// <param name="bodyType"></param>
 /// <param name="density"></param>
 public PhysicsGameEntity(Game game, World world, Category collisionCategory, Vertices vertices, BodyType bodyType, float density)
     : this(game,world,collisionCategory)
 {
     ConstructFromVertices(world,vertices,density);
     Body.BodyType = bodyType;
     Body.CollisionCategories = collisionCategory;
 }
开发者ID:dreasgrech,项目名称:FarseerPhysicsBaseFramework,代码行数:15,代码来源:PhysicsGameEntity.cs

示例9: FarseerObject

 public FarseerObject(FarseerWorld world, Shape shape, BodyType BodyType = BodyType.Dynamic)
 {            
     body = new Body(world.World);
     body.BodyType = BodyType;
     body.CreateFixture(shape);
     body.Enabled = false;            
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:7,代码来源:FarseerObject.cs

示例10: Scope

 public Scope(BodyType bodyType, Scope parent, ReadOnlyArray<string> parameters)
 {
     _bodyType = bodyType;
     Parent = parent;
     _parameters = parameters;
     _rootScope = parent != null ? parent._rootScope : this;
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:7,代码来源:AstBuilder.Scope.cs

示例11: Sprite

        public Sprite(
            string Name,
            Vector2 location,
            Texture2D texture,
            Rectangle initialFrame,
            Vector2 velocity,
            BodyType bodytype,
            bool AddFixture
            ) // True
        {
            this.location = location;
            Texture = texture;

            this.name = Name;
            this.dead = false;

            frames.Add(initialFrame);
            frameWidth = initialFrame.Width;
            frameHeight = initialFrame.Height;
            origin = new Vector2(frameWidth / 2, frameHeight / 2);

            tag = null;

            body = BodyFactory.CreateBody(GameWorld.world);
            body.BodyType = bodytype;
            body.SleepingAllowed = false;
            //body.UserData = this; // NO!!!!

            spriteEffects = new SpriteEffects();
            flipType = new FlipType();
            flipType = FlipType.NONE;


            body.Restitution = .2f;
            body.Mass = 100;
            body.Friction = 10;
            //body.LinearDamping = 2.4f;
            //body.AngularDamping = 6.4f;
            /*body.Rotation = 1.3f;
            //            box.AngularVelocity = 0.1f;
            body.Inertia = 25.5f;
            */
            this.Fade = false;
            this.Location = location;
            //            body.Position = ConvertUnits.ToSimUnits(this.Location);
            body.IgnoreGravity = false;

            if (AddFixture)
            {
                bodyfixture = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(initialFrame.Width), ConvertUnits.ToSimUnits(initialFrame.Height), 10, Vector2.Zero, body);
                bodyfixture.Restitution = .5f;
                bodyfixture.Friction = 1;

                bodyfixture.OnCollision += new OnCollisionEventHandler(HandleCollision);
                PhysicsBodyFixture = bodyfixture;
            }

            this.Velocity = ConvertUnits.ToSimUnits(velocity);
        }
开发者ID:BenMatase,项目名称:RaginRovers,代码行数:59,代码来源:Sprite.cs

示例12: setBodyType

		public FSRigidBody setBodyType( BodyType bodyType )
		{
			if( body != null )
				body.bodyType = bodyType;
			else
				_bodyDef.bodyType = bodyType;
			return this;
		}
开发者ID:prime31,项目名称:Nez,代码行数:8,代码来源:FSRigidBody.cs

示例13: createBody

 public override void createBody(World _physics, BodyType _type)
 {
     base.createBody(_physics, _type);
     mBody.UserData = this;
     mBody.OnCollision += new OnCollisionEventHandler(collision);
     mBody.CollisionCategories = Category.Cat3;
     mBody.CollidesWith = Category.All & ~Category.Cat3;
 }
开发者ID:Jamsterx1,项目名称:Titan,代码行数:8,代码来源:Bullet.cs

示例14: PhysicalObject

 public PhysicalObject(World world, Vector2 position, BodyType bodyType, Texture2D texture, Vector2 size, float mass)
 {
     _body = BodyFactory.CreateRectangle(world, size.X * _pixelToUnit, size.Y * _pixelToUnit, mass);
     _body.BodyType = bodyType;
     Position = position;
     this.Size = size;
     this._texture = texture;
 }
开发者ID:Alismuffin,项目名称:ZalikstairGame,代码行数:8,代码来源:PhysicalObject.cs

示例15: createCapsule

			public static Body createCapsule( World world, float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null )
			{
				height *= FSConvert.displayToSim;
				topRadius *= FSConvert.displayToSim;
				bottomRadius *= FSConvert.displayToSim;
				position *= FSConvert.displayToSim;

				return FarseerPhysics.Factories.BodyFactory.CreateCapsule( world, height, topRadius, topEdges, bottomRadius, bottomEdges, density, position, rotation, bodyType, userData );
			}
开发者ID:prime31,项目名称:Nez,代码行数:9,代码来源:BodyFactory.cs


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