| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using Microsoft.Xna.Framework;
- namespace MonoGame.Extended.Tilemaps
- {
- /// <summary>
- /// Represents an elliptical object in a tilemap.
- /// </summary>
- public class TilemapEllipseObject : TilemapObject
- {
- /// <summary>
- /// Gets or sets the size of the ellipse's bounding rectangle.
- /// </summary>
- public Vector2 Size { get; set; }
- /// <summary>
- /// Gets the center point of the ellipse.
- /// </summary>
- public Vector2 Center
- {
- get
- {
- return Position + Size * 0.5f;
- }
- }
- /// <summary>
- /// Gets the horizontal radius of the ellipse.
- /// </summary>
- public float RadiusX
- {
- get
- {
- return Size.X * 0.5f;
- }
- }
- /// <summary>
- /// Gets the vertical radius of the ellipse.
- /// </summary>
- public float RadiusY
- {
- get
- {
- return Size.Y * 0.5f;
- }
- }
- /// <inheritdoc/>
- public override RectangleF Bounds
- {
- get
- {
- return new RectangleF(Position.X, Position.Y, Size.X, Size.Y);
- }
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="TilemapEllipseObject"/> class.
- /// </summary>
- /// <param name="id">The unique identifier for the object.</param>
- /// <param name="position">The position fo the top-left corner of the bounding rectangle.</param>
- /// <param name="size">The size of the bounding rectangle.</param>
- public TilemapEllipseObject(int id, Vector2 position, Vector2 size) : base(id, position)
- {
- Size = size;
- }
- }
- }
|