當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。