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


C# Shape.Clone方法代码示例

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


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

示例1: Fixture

        public Fixture(Body body, Shape shape, object userData)
        {
            if (Settings.UseFPECollisionCategories)
                _collisionCategories = Category.All;
            else
                _collisionCategories = Category.Cat1;

            _collidesWith = Category.All;
            _collisionGroup = 0;

            //Fixture defaults
            Friction = 0.2f;
            Restitution = 0;

            IsSensor = false;

            Body = body;
            UserData = userData;

            if (Settings.ConserveMemory)
                Shape = shape;
            else
                Shape = shape.Clone();

            RegisterFixture();
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:26,代码来源:Fixture.cs

示例2: Fixture

        internal Fixture(Body body, Shape shape, object userData = null)
        {
#if DEBUG
            if (shape.ShapeType == ShapeType.Polygon)
                ((PolygonShape)shape).Vertices.AttachedToBody = true;
#endif

            _collisionCategories = Settings.DefaultFixtureCollisionCategories;
            _collidesWith = Settings.DefaultFixtureCollidesWith;
            _collisionGroup = 0;

            IgnoreCCDWith = Settings.DefaultFixtureIgnoreCCDWith;

            //Fixture defaults
            Friction = 0.2f;
            Restitution = 0;

            Body = body;
            IsSensor = false;

            UserData = userData;

            Shape = Settings.ConserveMemory ? shape : shape.Clone();

            RegisterFixture();
        }
开发者ID:netonjm,项目名称:Rube.Net,代码行数:26,代码来源:Fixture.cs

示例3: FSFixture

		public FSFixture(FSBody body, Shape shape, object userData) {
			_collisionCategories = FSSettings.DefaultFixtureCollisionCategories;
			_collidesWith = FSSettings.DefaultFixtureCollidesWith;
			_collisionGroup = 0;

#if USE_IGNORE_CCD_CATEGORIES
			IgnoreCCDWith = FSSettings.DefaultFixtureIgnoreCCDWith;
#endif

			//Fixture defaults
			Friction = 0.2f;
			Restitution = 0;

			Body = body;
			IsSensor = false;

			UserData = userData;

			if (FSSettings.ConserveMemory)
				Shape = shape;
			else
				if (shape != null) Shape = shape.Clone();

			RegisterFixture();
		}
开发者ID:horsman,项目名称:survival,代码行数:25,代码来源:FSFixture.cs

示例4: Fixture

        internal Fixture(Body body, Shape shape, float density)
        {
            //Fixture defaults
            Friction = 0.2f;
            _collisionCategories = CollisionCategory.All;
            _collidesWith = CollisionCategory.All;
            IsSensor = false;

            Body = body;

            #if ConserveMemory
            Shape = shape;
            #else
            Shape = shape.Clone();
            #endif
            // Reserve proxy space
            int childCount = Shape.ChildCount;
            Proxies = new FixtureProxy[childCount];
            for (int i = 0; i < childCount; ++i)
            {
                Proxies[i] = new FixtureProxy();
                Proxies[i].Fixture = null;
                Proxies[i].ProxyId = BroadPhase.NullProxy;
            }
            ProxyCount = 0;

            Density = density;

            FixtureId = _fixtureIdCounter++;
        }
开发者ID:HaKDMoDz,项目名称:Lunar-Development-Kit,代码行数:30,代码来源:Fixture.cs

示例5: Fixture

        public Fixture(Body body, Shape shape, Object userData)
        {
            CollisionFilter = new CollisionFilter(this);

            //Fixture defaults
            Friction = 0.2f;
            Restitution = 0;

            IsSensor = false;

            Body = body;
            UserData = userData;

            if (Settings.ConserveMemory)
                Shape = shape;
            else
                Shape = shape.Clone();

            // Reserve proxy space
            int childCount = Shape.ChildCount;
            Proxies = new FixtureProxy[childCount];
            for (int i = 0; i < childCount; ++i)
            {
                Proxies[i] = new FixtureProxy();
                Proxies[i].Fixture = null;
                Proxies[i].ProxyId = BroadPhase.NullProxy;
            }
            ProxyCount = 0;

            FixtureId = _fixtureIdCounter++;

            if ((Body.Flags & BodyFlags.Enabled) == BodyFlags.Enabled)
            {
                BroadPhase broadPhase = Body.World.ContactManager.BroadPhase;
                CreateProxies(broadPhase, ref Body.Xf);
            }

            Body.FixtureList.Add(this);

            // Adjust mass properties if needed.
            if (Shape._density > 0.0f)
            {
                Body.ResetMassData();
            }

            // Let the world know we have a new fixture. This will cause new contacts
            // to be created at the beginning of the next time step.
            Body.World.Flags |= WorldFlags.NewFixture;

            if (Body.World.FixtureAdded != null)
            {
                Body.World.FixtureAdded(this);
            }
        }
开发者ID:dvgamer,项目名称:GhostLegend-XNA,代码行数:54,代码来源:Fixture.cs

示例6: GlomFixture

        private static Fixture GlomFixture(World world, Body oldBody, List<Body> thisSideBodies, Shape shape, DebugMaterial mat, List<Joint> joints)
        {
            foreach (Body lb in thisSideBodies)
            {
                foreach (Fixture lf in lb.FixtureList)
                {
                    Manifold m = new Manifold();
                    PolygonShape newShape = shape.Clone() as PolygonShape;
                    PolygonShape existingShape = lf.Shape as PolygonShape;
                    if (newShape != null && existingShape != null)
                    {
                        Collision.Collision.CollidePolygons(ref m, newShape, ref oldBody.Xf, existingShape, ref oldBody.Xf);
                        if (m.PointCount > 0)
                        {
                            Fixture glommed = lb.CreateFixture(newShape, mat);
                            transferJoints(oldBody, joints, lb, glommed);
                            return glommed;
                        }
                    }
                }
            }

            

            Body lb2 = new Body(world);
            if (!thisSideBodies.Any())
            {
                transferJoints(oldBody, joints, lb2, null);
            }

            lb2.Position = oldBody.Position;
            lb2.Rotation = oldBody.Rotation;
            thisSideBodies.Add(lb2);
            Fixture separate = lb2.CreateFixture(shape.Clone(), mat);
            transferJoints(oldBody, joints, lb2, separate);
            return separate;
        }
开发者ID:guozanhua,项目名称:KinectRagdoll,代码行数:37,代码来源:CuttingTools.cs


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