예제 #1
0
        public Dictionary <string, bool> generateCollisionDictionary(CollisionMesh other_object_collision_mesh)
        {
            Dictionary <string, bool> collisionDictionary = new Dictionary <string, bool>();

            collisionDictionary.Add("TOP", false);
            collisionDictionary.Add("BOTTOM", false);
            collisionDictionary.Add("LEFT", false);
            collisionDictionary.Add("RIGHT", false);

            if (isCollisionTop_Bottom(other_object_collision_mesh))
            {
                collisionDictionary["TOP"] = true;
            }
            else if (isCollisionBottom_Top(other_object_collision_mesh))
            {
                collisionDictionary["BOTTOM"] = true;
            }
            else if (isCollisionLeft_Right(other_object_collision_mesh))
            {
                collisionDictionary["LEFT"] = true;
            }
            else if (isCollisionRight_Left(other_object_collision_mesh))
            {
                collisionDictionary["RIGHT"] = true;
            }
            return(collisionDictionary);
        }
예제 #2
0
        public bool isCollisionRight_Left(CollisionMesh other_object_collision_mesh)
        {
            bool answer = false;

            if (
                isCollisionRightMiddle_with_Left(other_object_collision_mesh))
            {
                answer = true;
            }
            return(answer);
        }
예제 #3
0
        public bool isCollisionTop_Bottom(CollisionMesh other_object_collision_mesh)
        {
            bool answer = false;

            if (
                isCollisionTopMiddle_with_bottom(other_object_collision_mesh)
                )
            {
                answer = true;
            }
            return(answer);
        }
예제 #4
0
        public bool isCollisionBottomLeft_with_Top(CollisionMesh other_object_collision_mesh)
        {
            bool  answer = false;
            Point other_bottom_left_point = other_object_collision_mesh.Bottom_left_point;

            if (other_bottom_left_point.X >= this.Top_left_point.X &&
                other_bottom_left_point.X <= this.Top_right_point.X &&
                other_bottom_left_point.Y >= this.Top_middle_point.Y &&
                other_bottom_left_point.Y <= this.Bottom_middle_point.Y)
            {
                answer = true;
            }
            return(answer);
        }
예제 #5
0
        public bool isCollisionTopMiddle_with_bottom(CollisionMesh other_object_collision_mesh)
        {
            bool  answer = false;
            Point other_top_middle_point = other_object_collision_mesh.Top_middle_point;

            if (Math.Abs(other_top_middle_point.X) >= Math.Abs(this.Bottom_left_point.X) &&
                Math.Abs(other_top_middle_point.X) <= Math.Abs(this.Bottom_right_point.X) &&
                Math.Abs(other_top_middle_point.Y) <= Math.Abs(this.bottom_middle_point.Y) &&
                Math.Abs(other_top_middle_point.Y) >= Math.Abs(this.Top_middle_point.Y))
            {
                answer = true;
            }
            return(answer);
        }
예제 #6
0
        public bool isCollisionLeftBottom_with_Right(CollisionMesh other_object_collision_mesh)
        {
            bool  answer = false;
            Point other_left_bottom_point = other_object_collision_mesh.Bottom_left_point;

            if (Math.Abs(other_left_bottom_point.Y) >= Math.Abs(this.Top_left_point.Y) &&
                Math.Abs(other_left_bottom_point.Y) <= Math.Abs(this.Bottom_left_point.Y) &&
                Math.Abs(other_left_bottom_point.X) <= Math.Abs(this.Middle_left_point.X) &&
                Math.Abs(other_left_bottom_point.X) >= Math.Abs(this.Middle_right_point.X))
            {
                answer = true;
            }
            return(answer);
        }
예제 #7
0
        public Point isAnyCollision(CollisionMesh other_object_collision_mesh)
        {
            Point collisionPoint = new  Point(-1, -1);

            if (isCollisionTop_Bottom(other_object_collision_mesh))
            {
                collisionPoint = this.Top_middle_point;
            }
            else if (isCollisionBottom_Top(other_object_collision_mesh))
            {
                collisionPoint = this.Bottom_middle_point;
            }
            else if (isCollisionLeft_Right(other_object_collision_mesh))
            {
                collisionPoint = this.Middle_left_point;
            }
            else if (isCollisionRight_Left(other_object_collision_mesh))
            {
                collisionPoint = this.Middle_right_point;
            }

            return(collisionPoint);
        }