コード例 #1
0
        void MagnetDetachObject(MagnetObjectItem item)
        {
            item.fixedJoint.Dispose();
            UnsubscribeToDeletionEvent(item.mapObject);

            magnetAttachedObjects.Remove(item);
        }
コード例 #2
0
        void CreateFixedJointForAttachedObject(MagnetObjectItem item)
        {
            FixedJoint fixedJoint = PhysicsWorld.Instance.CreateFixedJoint(magnetBody, item.body);

            fixedJoint.PushedToWorld = true;
            item.fixedJoint          = fixedJoint;
        }
コード例 #3
0
        void MagnetAttachObject(Body mapObjectBody)
        {
            if (mapObjectBody.IsDisposed)
            {
                return;
            }

            if (IsMagnetBodyAttached(mapObjectBody))
            {
                Log.Fatal("Crane: MagnetAttachObject: IsMagnetBodyAttached( mapObjectBody ).");
            }

            MapObject mapObject = MapSystemWorld.GetMapObjectByBody(mapObjectBody);

            if (mapObject != null && mapObject.PhysicsModel != null)
            {
                MagnetObjectItem item = new MagnetObjectItem();
                item.mapObject = mapObject;
                item.body      = mapObjectBody;
                item.bodyIndex = Array.IndexOf <Body>(mapObject.PhysicsModel.Bodies, mapObjectBody);

                SubscribeToDeletionEvent(mapObject);

                CreateFixedJointForAttachedObject(item);

                magnetAttachedObjects.Add(item);
            }
        }
コード例 #4
0
        void MagnetDetachObject(MagnetObjectItem item)
        {
            item.fixedJoint.Dispose();
            RemoveRelationship(item.mapObject);

            magnetAttachedObjects.Remove(item);
        }
コード例 #5
0
        void MagnetAttachObject(Body mapObjectBody)
        {
            if (mapObjectBody.IsDisposed)
            {
                return;
            }

            Trace.Assert(!IsMagnetBodyAttached(mapObjectBody));

            MapObject mapObject = MapSystemWorld.GetMapObjectByBody(mapObjectBody);

            if (mapObject == null)
            {
                return;
            }

            MagnetObjectItem item = new MagnetObjectItem();

            item.mapObject = mapObject;
            item.body      = mapObjectBody;
            item.bodyIndex = Array.IndexOf <Body>(mapObject.PhysicsModel.Bodies, mapObjectBody);

            AddRelationship(mapObject);

            CreateFixedJointForAttachedObject(item);

            magnetAttachedObjects.Add(item);
        }
コード例 #6
0
ファイル: Crane.cs プロジェクト: CITS4242B2010/project2010
        void MagnetDetachObject( MagnetObjectItem item )
        {
            item.fixedJoint.Dispose();
            RemoveRelationship( item.mapObject );

            magnetAttachedObjects.Remove( item );
        }
コード例 #7
0
ファイル: Crane.cs プロジェクト: CITS4242B2010/project2010
        void MagnetAttachObject( Body mapObjectBody )
        {
            if( mapObjectBody.IsDisposed )
                return;

            Trace.Assert( !IsMagnetBodyAttached( mapObjectBody ) );

            MapObject mapObject = MapSystemWorld.GetMapObjectByBody( mapObjectBody );
            if( mapObject == null )
                return;

            MagnetObjectItem item = new MagnetObjectItem();
            item.mapObject = mapObject;
            item.body = mapObjectBody;
            item.bodyIndex = Array.IndexOf<Body>( mapObject.PhysicsModel.Bodies, mapObjectBody );

            AddRelationship( mapObject );

            CreateFixedJointForAttachedObject( item );

            magnetAttachedObjects.Add( item );
        }
コード例 #8
0
ファイル: Crane.cs プロジェクト: CITS4242B2010/project2010
 void CreateFixedJointForAttachedObject( MagnetObjectItem item )
 {
     FixedJoint fixedJoint = PhysicsWorld.Instance.CreateFixedJoint( magnetBody, item.body );
     fixedJoint.PushedToWorld = true;
     item.fixedJoint = fixedJoint;
 }
コード例 #9
0
ファイル: Crane.cs プロジェクト: whztt07/NeoAxisCommunity
		void MagnetDetachObject( MagnetObjectItem item )
		{
			item.fixedJoint.Dispose();
			UnsubscribeToDeletionEvent( item.mapObject );

			magnetAttachedObjects.Remove( item );
		}
コード例 #10
0
ファイル: Crane.cs プロジェクト: whztt07/NeoAxisCommunity
		void MagnetAttachObject( Body mapObjectBody )
		{
			if( mapObjectBody.IsDisposed )
				return;

			if( IsMagnetBodyAttached( mapObjectBody ) )
				Log.Fatal( "Crane: MagnetAttachObject: IsMagnetBodyAttached( mapObjectBody )." );

			MapObject mapObject = MapSystemWorld.GetMapObjectByBody( mapObjectBody );
			if( mapObject != null && mapObject.PhysicsModel != null )
			{
				MagnetObjectItem item = new MagnetObjectItem();
				item.mapObject = mapObject;
				item.body = mapObjectBody;
				item.bodyIndex = Array.IndexOf<Body>( mapObject.PhysicsModel.Bodies, mapObjectBody );

				SubscribeToDeletionEvent( mapObject );

				CreateFixedJointForAttachedObject( item );

				magnetAttachedObjects.Add( item );
			}
		}