Beispiel #1
0
        public virtual CCPhysicsBody AddBodyOrDelay(CCPhysicsBody body)
        {
            CCPhysicsBody removeBodyIter = DelayRemoveBodies.Find(b => b == body);

            if (removeBodyIter != null)
            {
                DelayRemoveBodies.Remove(removeBodyIter);
                return(null);
            }

            if (Info.IsLocked())
            {
                if (DelayAddBodies.Exists(b => b == body))
                {
                    DelayAddBodies.Add(body);
                    DelayDirty = true;
                }
            }
            else
            {
                DoAddBody(body);
            }

            return(body);
        }
Beispiel #2
0
        public virtual void RemoveBodyOrDelay(CCPhysicsBody body)
        {
            if (DelayAddBodies.Exists(b => b == body))
            {
                DelayAddBodies.Remove(body);
                return;
            }

            if (Info.IsLocked())
            {
                if (DelayRemoveBodies.Exists(b => b == body))
                {
                    DelayRemoveBodies.Add(body);
                    DelayDirty = true;
                }
            }
            else
            {
                DoRemoveBody(body);
            }
        }