コード例 #1
0
        public void CheckCollisionsAgainst(CollisionComponent other)
        {
            int collision = 0;

            for (int i = 0; i < prims.Count; ++i)
            {
                for (int y = 0; y < other.prims.Count; ++y)
                {
                    CollResult c = prims[i].CheckAgainst(other.prims[y], tran, other.tran);
                    if (c.collided)
                    {
                        if (callback != null)
                        {
                            callback(this, other, c, collision);
                        }
                        CollResult otherC = c;
                        otherC.normal *= -1;
                        if (other.callback != null)
                        {
                            other.callback(other, this, otherC, collision++);
                        }
                    } //Note, currently multiple callbacks can be made, each with their own index
                }
            }
        }
コード例 #2
0
        public void CheckCollisionsAgainst(CollisionComponent other)
        {
            int collision = 0;
            for(int i = 0; i < prims.Count; ++i)
            {
                for(int y = 0; y < other.prims.Count; ++y)
                {
                    CollResult c = prims[i].CheckAgainst(other.prims[y], tran, other.tran);
                    if(c.collided)
                    {

                        if (callback != null) callback(this, other, c, collision);
                        CollResult otherC = c;
                        otherC.normal *= -1;
                        if(other.callback != null) other.callback(other, this, otherC, collision++);
                    } //Note, currently multiple callbacks can be made, each with their own index
                }
            }
        }