using Microsoft.Xna.Framework;
namespace MonoGame.Extended.Tilemaps
{
///
/// Base class for all tilemap layers.
///
public abstract class TilemapLayer
{
///
/// Gets the name of the layer.
///
public string Name { get; }
///
/// Gets or sets the class/type identifier for this layer.
///
public string Class { get; set; } = string.Empty;
///
/// Gets or sets a value indicating whether the layer is visible.
///
public bool IsVisible { get; set; }
///
/// Gets or sets the opacity of the layer.
///
/// A value between 0.0 (fully transparent) and 1.0 (fully opaque).
public float Opacity { get; set; }
///
/// Gets or sets the tint color applied to the layer.
///
public Color? TintColor { get; set; }
///
/// Gets or sets the rendering offset for the layer.
///
public Vector2 Offset { get; set; }
///
/// Gets or sets the parallax scrolling factor for this layer, affecting scrolling speed relative to the camera.
///
/// A factor where (1,1) represents normal scrolling.
///
/// A factor of (1, 1) scrolls at normal speed. Values less than 1 create a background effect,
/// while values greater than 1 create a foreground effect.
/// This feature is primarily used by Tiled. For other formats, this value will be (1, 1).
///
public Vector2 ParallaxFactor { get; set; }
///
/// Gets the custom properties of the layer.
///
public TilemapProperties Properties { get; }
///
/// Gets the bounding rectangle of the layer in world coordinates.
///
public abstract Rectangle Bounds { get; }
///
/// Initializes a new instance of the class.
///
/// The name of the layer.
protected TilemapLayer(string name)
{
Name = name;
IsVisible = true;
Opacity = 1.0f;
ParallaxFactor = Vector2.One;
Properties = new TilemapProperties();
}
}
}