Beispiel #1
0
        /** Searches for physics shapes that contains in the rect. */
        public void QueryRect(Func <CCPhysicsWorld, CCPhysicsShape, object, bool> func, CCRect rect, object data)
        {
            cp.AssertWarn(func != null, "func shouldn't be nullptr");
            if (func != null)
            {
                CCRectQueryCallbackInfo info = new CCRectQueryCallbackInfo()
                {
                    world = this,
                    func  = func,
                    data  = data
                };

                CCPhysicsWorldCallback.continues = true;

                this._info.getSpace().BBQuery(
                    PhysicsHelper.rect2cpbb(rect),
                    new cpShapeFilter(cp.NO_GROUP, cp.ALL_LAYERS, cp.ALL_LAYERS),
                    (s, o) => CCPhysicsWorldCallback.QueryRectCallbackFunc(s, info),
                    data
                    );
            }
        }