| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System.Collections.Generic;
- using Microsoft.Xna.Framework.Graphics;
- namespace MonoGame.Extended.Tilemaps
- {
- /// <summary>
- /// Represents metadata and properties for a specific tile in a tileset.
- /// </summary>
- /// <remarks>
- /// Tile data contains information such as custom properties, animations,
- /// collision shapes, and custom images for individual tiles.
- /// </remarks>
- public class TilemapTileData
- {
- /// <summary>
- /// Gets the local tile ID within the tileset.
- /// </summary>
- public int LocalId { get; }
- /// <summary>
- /// Gets or sets the class/type identifier for the tile.
- /// </summary>
- public string Class { get; set; } = string.Empty;
- /// <summary>
- /// Gets or sets the probability of this tile being used in random tile generation.
- /// </summary>
- /// <value>A value between 0.0 and 1.0, where 1.0 is the default probability.</value>
- public float Probability { get; set; }
- /// <summary>
- /// Gets the custom properties of the tile.
- /// </summary>
- public TilemapProperties Properties { get; }
- /// <summary>
- /// Gets or sets the animation data for animated tiles.
- /// </summary>
- public TilemapTileAnimation Animation { get; set; }
- /// <summary>
- /// Gets the collision objects associated with this tile.
- /// </summary>
- /// <remarks>
- /// Collision objects define the collision shape(s) for the tile and will be
- /// integrated with the 2D collision system.
- /// </remarks>
- public List<TilemapObject> CollisionObjects { get; }
- /// <summary>
- /// Gets or sets a custom image texture for this tile.
- /// </summary>
- /// <remarks>
- /// When set, this texture overrides the tileset's atlas texture for this specific tile.
- /// </remarks>
- public Texture2D CustomImage { get; set; }
- /// <summary>
- /// Initializes a new instance of the <see cref="TilemapTileData"/> class.
- /// </summary>
- /// <param name="localId">The local tile ID within the tileset.</param>
- public TilemapTileData(int localId)
- {
- LocalId = localId;
- Properties = new TilemapProperties();
- CollisionObjects = new List<TilemapObject>();
- Probability = 1.0f;
- }
- }
- }
|