TilemapRectangleObject.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Microsoft.Xna.Framework;
  2. namespace MonoGame.Extended.Tilemaps
  3. {
  4. /// <summary>
  5. /// Represents a rectangular object in a tilemap.
  6. /// </summary>
  7. public class TilemapRectangleObject : TilemapObject
  8. {
  9. /// <summary>
  10. /// Gets or sets the size of the rectangle.
  11. /// </summary>
  12. public Vector2 Size { get; set; }
  13. /// <inheritdoc/>
  14. public override RectangleF Bounds
  15. {
  16. get
  17. {
  18. return new RectangleF(Position.X, Position.Y, Size.X, Size.Y);
  19. }
  20. }
  21. // NOTE: Will use BoundingBox2D or OrientedBoundingBox2D
  22. /// <summary>
  23. /// Initializes a new instance of the <see cref="TilemapRectangleObject"/> class.
  24. /// </summary>
  25. /// <param name="id">The unique identifier for the object.</param>
  26. /// <param name="position">The position of the top-left corner.</param>
  27. /// <param name="size">The size of the rectangle.</param>
  28. public TilemapRectangleObject(int id, Vector2 position, Vector2 size) : base(id, position)
  29. {
  30. Size = size;
  31. }
  32. }
  33. }