Пример #1
0
        // check if this overlaps with another rectangle
        public bool Overlaps(IntersectableRectangle other)
        {
            RectangleGraphic intersectRectangle      = GetIntersectRectangle();
            RectangleGraphic otherIntersectRectangle = other.GetIntersectRectangle();

            return(intersectRectangle.GetX1().Round() <= otherIntersectRectangle.GetX2().Round() && intersectRectangle.GetX2().Round() >= otherIntersectRectangle.GetX1().Round() &&
                   intersectRectangle.GetY1().Round() <= otherIntersectRectangle.GetY2().Round() && intersectRectangle.GetY2().Round() >= otherIntersectRectangle.GetY1().Round());
        }
Пример #2
0
 // gets scaled bounds taking into account map camera position
 public RectangleGraphic GetCalibratedScaledBounds()
 {
     if (map != null)
     {
         RectangleGraphic scaledBounds = GetScaledBounds();
         return(new RectangleGraphic(
                    scaledBounds.GetX1().Round() - map.GetCamera().X.Round(),
                    scaledBounds.GetY1().Round() - map.GetCamera().Y.Round(),
                    scaledBounds.GetScaledWidth(),
                    scaledBounds.GetScaledHeight()
                    ));
     }
     else
     {
         return(GetScaledBounds());
     }
 }
Пример #3
0
 public float GetBoundsX1()
 {
     return(X + bounds.GetX1());
 }