Beispiel #1
0
        public virtual void UpdateJoints()
        {
            if (Info.IsLocked())
            {
                return;
            }

            CCPhysicsJoint[] addCopy = new CCPhysicsJoint[DelayAddJoints.Count];

            DelayAddJoints.CopyTo(addCopy);

            DelayAddJoints.Clear();

            foreach (var joint in addCopy)
            {
                DoAddJoint(joint);
            }

            CCPhysicsJoint[] removeCopy = new CCPhysicsJoint[DelayRemoveJoints.Count];
            DelayRemoveJoints.CopyTo(removeCopy);

            DelayRemoveJoints.Clear();
            foreach (var joint in removeCopy)
            {
                DoRemoveJoint(joint);

                if (joint._destoryMark)
                {
                    //delete joint;
                }
            }
        }
Beispiel #2
0
        public virtual void RemoveJointOrDelay(CCPhysicsJoint joint)
        {
            var it = DelayAddJoints.Find(j => j == joint);

            if (it != null)
            {
                DelayAddJoints.Remove(it);
            }
            if (Info.IsLocked())
            {
                if (!DelayAddJoints.Exists(j => j == joint))
                {
                    DelayRemoveJoints.Add(joint);
                    DelayDirty = true;
                }
            }
            else
            {
                DoRemoveJoint(joint);
            }
        }