Beispiel #1
0
        public void MakeEntityGroup(int collisionGroup)
        {
            for (int i = 0; i < collisionRelations.Count; i++)
            {
                if (collisionRelations[i].colGroup1 == collisionGroup || collisionRelations[i].colGroup2 == collisionGroup)
                {
                    collisionRelations.RemoveAt(i); --i;
                }
            }

            CollisionGroupRelations relation = new CollisionGroupRelations();

            relation.colGroup1 = collisionGroup;
            relation.colGroup2 = -1;
            relation.relations = CollisionRelations.ISENTITY;
            collisionRelations.Add(relation);
        }
Beispiel #2
0
        public void SetCollisions(int collisionGroupA, int collisionGroupB, bool collisionEnabled)
        {
            RemoveCollisionForAll(collisionGroupA);
            RemoveCollisionForAll(collisionGroupB);

            for (int i = 0; i < collisionRelations.Count; i++)
            {
                if (collisionRelations[i].colGroup1 == collisionGroupA && collisionRelations[i].colGroup2 == collisionGroupB ||
                    collisionRelations[i].colGroup1 == collisionGroupB && collisionRelations[i].colGroup2 == collisionGroupA
                    )
                {
                    if (!collisionEnabled)
                    {
                        collisionRelations[i].relations = CollisionRelations.DISABLECOLLISION;
                    }
                    else
                    {
                        collisionRelations[i].relations = CollisionRelations.ALLOWCOLLISION;
                    }

                    return;
                }
            }
            CollisionGroupRelations rel = new CollisionGroupRelations();

            rel.colGroup1 = collisionGroupA;
            rel.colGroup2 = collisionGroupB;
            if (!collisionEnabled)
            {
                rel.relations = CollisionRelations.DISABLECOLLISION;
            }
            else
            {
                rel.relations = CollisionRelations.ALLOWCOLLISION;
            }
            // rel.AllowCollisions = collisionEnabled;

            collisionRelations.Add(rel);
        }
Beispiel #3
0
        public void SetCollisionForAll(int collisionGroup, bool collisionEnabled)
        {
            for (int i = 0; i < collisionRelations.Count; i++)
            {
                if (collisionRelations[i].colGroup1 == collisionGroup || collisionRelations[i].colGroup2 == collisionGroup)
                {
                    collisionRelations.RemoveAt(i); --i;
                }
            }

            CollisionGroupRelations relation = new CollisionGroupRelations();

            relation.colGroup1 = collisionGroup;
            relation.colGroup2 = -1;
            if (!collisionEnabled)
            {
                relation.relations = CollisionRelations.DISABLECOLLISION;
            }
            else
            {
                relation.relations = CollisionRelations.ALLOWCOLLISION;
            }
            collisionRelations.Add(relation);
        }
Beispiel #4
0
        public void SetCollisions(int collisionGroupA, int collisionGroupB, bool collisionEnabled)
        {
            RemoveCollisionForAll(collisionGroupA);
            RemoveCollisionForAll(collisionGroupB);

            for (int i = 0; i < collisionRelations.Count; i++)
            {
                if (collisionRelations[i].colGroup1 == collisionGroupA && collisionRelations[i].colGroup2 == collisionGroupB ||
                    collisionRelations[i].colGroup1 == collisionGroupB && collisionRelations[i].colGroup2 == collisionGroupA
                    )
                {
                    if (!collisionEnabled)
                    {
                        collisionRelations[i].relations = CollisionRelations.DISABLECOLLISION;
                    }
                    else
                    {
                        collisionRelations[i].relations = CollisionRelations.ALLOWCOLLISION;
                    }

                    return;
                }
            }
            CollisionGroupRelations rel = new CollisionGroupRelations();
            rel.colGroup1 = collisionGroupA;
            rel.colGroup2 = collisionGroupB;
            if (!collisionEnabled)
            {
                rel.relations = CollisionRelations.DISABLECOLLISION;
            }
            else
            {
                rel.relations = CollisionRelations.ALLOWCOLLISION;
            }
               // rel.AllowCollisions = collisionEnabled;

            collisionRelations.Add(rel);
        }
Beispiel #5
0
        public void SetCollisionForAll(int collisionGroup, bool collisionEnabled)
        {
            for (int i = 0; i < collisionRelations.Count; i++)
            {
                if (collisionRelations[i].colGroup1 == collisionGroup || collisionRelations[i].colGroup2 == collisionGroup)
                {
                    collisionRelations.RemoveAt(i);--i;
                }
            }

            CollisionGroupRelations relation = new CollisionGroupRelations();
            relation.colGroup1 = collisionGroup;
            relation.colGroup2 = -1;
            if (!collisionEnabled)
            {
                relation.relations = CollisionRelations.DISABLECOLLISION;
            }
            else
            {
                relation.relations = CollisionRelations.ALLOWCOLLISION;
            }
            collisionRelations.Add(relation);
        }
Beispiel #6
0
        public void MakeEntityGroup(int collisionGroup)
        {
            for (int i = 0; i < collisionRelations.Count; i++)
            {
                if (collisionRelations[i].colGroup1 == collisionGroup || collisionRelations[i].colGroup2 == collisionGroup)
                {
                    collisionRelations.RemoveAt(i); --i;
                }
            }

            CollisionGroupRelations relation = new CollisionGroupRelations();
            relation.colGroup1 = collisionGroup;
            relation.colGroup2 = -1;
            relation.relations = CollisionRelations.ISENTITY;
            collisionRelations.Add(relation);
        }