示例#1
0
 void OnDestroy()
 {
     if (_mj != null)
     {
         _world.DestroyJoint(_mj);
     }
     _mj = null;
 }
示例#2
0
 virtual protected void onReCreate()
 {
     if (_joint != null && _world != null)
     {
         _world.DestroyJoint(_joint);
     }
 }
示例#3
0
    /** 开始拖动刚体*/
    private void startDragBody(b2Body b, float x, float y)
    {
        if (b == null || b.GetType() != b2Body.b2_dynamicBody)
        {
            return;
        }
        if (_mj != null)
        {
            _world.DestroyJoint(_mj);
        }
        b2MouseJointDef jointDef = new b2MouseJointDef();

        jointDef.bodyA = _world.GetGroundBody();
        jointDef.bodyB = b;
        jointDef.target.Set(x, y);
        jointDef.maxForce = 1e6f;
        _mj = _world.CreateJoint(jointDef) as b2MouseJoint;
    }
示例#4
0
        public virtual void MouseUp(b2Vec2 p)
        {
            if (m_mouseJoint != null)
            {
                m_world.DestroyJoint(m_mouseJoint);
                m_mouseJoint = null;
            }

            if (m_bombSpawning)
            {
                CompleteBombSpawn(p);
            }
        }