Beispiel #1
0
 protected bool IsTouchingRight(RectangleObject obj)
 {
     return(this.Rectangle.Left + this.Direction.X < obj.Rectangle.Right &&
            this.Rectangle.Right > obj.Rectangle.Right &&
            this.Rectangle.Bottom > obj.Rectangle.Top &&
            this.Rectangle.Top < obj.Rectangle.Bottom);
 }
Beispiel #2
0
 protected bool IsTouchingLeftTop(RectangleObject obj)
 {
     return(this.Rectangle.Right + this.Direction.X > obj.Rectangle.Left &&
            this.Rectangle.Left < obj.Rectangle.Left &&
            this.Rectangle.Top < obj.Rectangle.Top &&
            this.Rectangle.Bottom > obj.Rectangle.Top);
 }
Beispiel #3
0
 protected bool IsTouchingBottom(RectangleObject obj)
 {
     return(this.Rectangle.Top + this.Direction.Y < obj.Rectangle.Bottom &&
            this.Rectangle.Bottom > obj.Rectangle.Bottom &&
            this.Rectangle.Right > obj.Rectangle.Left &&
            this.Rectangle.Left < obj.Rectangle.Right);
 }
Beispiel #4
0
        public bool IsTouching(RectangleObject obj)
        {
            if (this.Rectangle.Intersects(obj.Rectangle))
            {
                return(true);
            }

            return(false);
        }