Exemplo n.º 1
0
        public void FilterArbiters(cpBody body, cpShape filter)
        {
            List <ulong> safeDelete = new List <ulong>();

            foreach (var hash in this.cachedArbiters)
            {
                cpArbiter arb = hash.Value;

                // Match on the filter shape, or if it's null the filter body
                if (
                    (body == arb.body_a && (filter == arb.a || filter == null)) ||
                    (body == arb.body_b && (filter == arb.b || filter == null))
                    )
                {
                    // Call separate when removing shapes.
                    if (filter != null && arb.state != cpArbiterState.Cached)
                    {
                        arb.state = cpArbiterState.Invalidated;
                        cpCollisionHandler handler = arb.handler;
                        handler.separateFunc(arb, this, handler.userData);
                    }

                    arb.Unthread();
                    this.arbiters.Remove(arb);
                    safeDelete.Add(hash.Key);
                }
            }

            foreach (var item in safeDelete)
            {
                cachedArbiters.Remove(item);
            }
        }
Exemplo n.º 2
0
        public void CallWildcardSeparateB(cpSpace space)
        {
            cpCollisionHandler handler = this.handlerB;

            this.swapped = !this.swapped;
            handler.separateFunc(this, space, handler.userData);
            this.swapped = !this.swapped;
        }
Exemplo n.º 3
0
        public void CallWildcardSeparateA(cpSpace space)
        {
            cpCollisionHandler handler = this.handlerA;

            handler.separateFunc(this, space, handler.userData);
        }