예제 #1
0
        public SkillObjCollision(SkillObj_Collision self, SkillBulletMove m, SkillVector3 v) : base(self, m, v)
        {
            CollisionType = SkillCollisionType.SkillObj;

            ActiveCollisions.Add(SkillCollisionType.SkillObj, SkillCollisionType.SkillObj);

            PassiveCollision.Add(SkillCollisionType.SkillObj, SkillCollisionType.SkillObj);
            PassiveCollision.Add(SkillCollisionType.SkillBullet, SkillCollisionType.SkillBullet);
        }
예제 #2
0
        private void CollisionCheck(bool Colliding, NucleonBoxCollider BoxCollider)
        {
            if (Colliding)
            {
                NucleonCollision Collision = new NucleonCollision();
                Collision.SelfCollider       = this;
                Collision.OtherCollider      = BoxCollider;
                Collision.CollisionDirection = DeltaPosition;

                Collision.TouchingMinX = CubeModel.MaxX >= BoxCollider.CubeModel.MinX && CubeModel.MaxX <= BoxCollider.CubeModel.MinX + (sfloat)0.1f;
                Collision.TouchingMaxX = CubeModel.MinX <= BoxCollider.CubeModel.MaxX && CubeModel.MinX >= BoxCollider.CubeModel.MaxX - (sfloat)0.1f;

                Collision.TouchingMinY = CubeModel.MaxY >= BoxCollider.CubeModel.MinY && CubeModel.MaxY <= BoxCollider.CubeModel.MinY + (sfloat)0.1f;
                Collision.TouchingMaxY = CubeModel.MinY <= BoxCollider.CubeModel.MaxY && CubeModel.MinY >= BoxCollider.CubeModel.MaxY - (sfloat)0.5f;

                Collision.TouchingMinZ = CubeModel.MaxZ >= BoxCollider.CubeModel.MinZ && CubeModel.MaxZ <= BoxCollider.CubeModel.MinZ + (sfloat)0.1f;
                Collision.TouchingMaxZ = CubeModel.MinZ <= BoxCollider.CubeModel.MaxZ && CubeModel.MinZ >= BoxCollider.CubeModel.MaxZ - (sfloat)0.1f;

                if (!ActiveCollisions.Contains(BoxCollider))
                {
                    ActiveCollisions.Add(BoxCollider);
                    Body?.OnNucleonCollisionEnter(Collision);
                }
            }
            else
            {
                if (ActiveCollisions.Contains(BoxCollider))
                {
                    NucleonCollisionExit CollisionExit = new NucleonCollisionExit();
                    CollisionExit.SelfCollider  = this;
                    CollisionExit.OtherCollider = BoxCollider;
                    CollisionExit.ExitDirection = DeltaPosition;

                    ActiveCollisions.Remove(BoxCollider);
                    Body?.OnNucleonCollisionExit(CollisionExit);
                }
            }
        }