TilemapTileObject.cs 1.3 KB

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