public void IntersectsItself() { Rectangle rectangle1 = new Rectangle { X = 1, Y = 1, Size = 1 }; Assert.IsTrue(rectangle1.Intersect(rectangle1)); }
public void IntersectsOut() { Rectangle rectangle1 = new Rectangle { X = 2, Y = 2, Size = 2 }; Rectangle rectangle2 = new Rectangle { X = 1, Y = 1, Size = 4 }; Assert.IsTrue(rectangle1.Intersect(rectangle2)); }
public void IntersectsRightBottom() { Rectangle rectangle1 = new Rectangle { X = 2, Y = 2, Size = 2 }; Rectangle rectangle2 = new Rectangle { X = 3, Y = 3, Size = 2 }; Assert.IsTrue(rectangle1.Intersect(rectangle2)); }
public void NotIntersects() { Rectangle rectangle1 = new Rectangle { X = 2, Y = 2, Size = 2 }; Rectangle rectangle2 = new Rectangle { X = 4, Y = 4, Size = 4 }; Assert.IsFalse(rectangle1.Intersect(rectangle2)); }
public void RemoveMapItem(int x, int y, int size = 1) { Rectangle r = new Rectangle { X = x, Y = y, Size = size }; Map.MapItems.RemoveAll(item => new Rectangle {X = item.X, Y = item.Y, Size = Map.MapItemSize[item.ItemType]}.Intersect(r)); RaisePropertyChanged(() => Map); }