13[JsonObject(IsReference =
true)]
14public class SceneLayerTile :
Tile
16 #region private / internal fields
18 [JsonIgnore]
internal SceneLayer parentSceneLayer;
24 [JsonProperty]
internal Point sceneLayerCoordinates;
26 #endregion private / internal fields
28 #region constructors / finalizer
31 private SceneLayerTile()
46 parentSceneLayer = sceneLayer;
53 internal void EnsureCollider()
60 collisionGroup: CollisionMasks.None,
61 collidesWith: CollisionMasks.None));
79 #endregion constructors / finalizer
84 get => base.EnableFog;
87 bool changed = enableFog != value;
88 base.EnableFog = value;
90 if (changed && !ReferenceEquals(parentSceneLayer,
SceneLayer.Empty))
91 parentSceneLayer.InvalidateFixedGridRenderEligibility();
104 if (!Enum.IsDefined(value))
105 throw new ArgumentOutOfRangeException(nameof(value));
107 if (_transform == value)
132 TileTransformGeometry.TransformSpacing(
133 TileTransformGeometry.ScaleOverhang(
157 base.Draw(backbuffer, destRectScreen);
161 var origin = TileTransformGeometry.MapToDestination(
new(0, 0), destRectScreen,
Transform);
162 var x = TileTransformGeometry.MapToDestination(
new(1, 0), destRectScreen,
Transform);
163 var y = TileTransformGeometry.MapToDestination(
new(0, 1), destRectScreen,
Transform);
165 var matrix =
new global::SkiaSharp.SKMatrix
167 ScaleX = x.X - origin.X,
168 SkewX = y.X - origin.X,
170 SkewY = x.Y - origin.Y,
171 ScaleY = y.Y - origin.Y,
176 var canvas = backbuffer.Canvas;
181 canvas.Concat(ref matrix);
200 parentSceneLayer?.TransformedTiles.Remove(
this);
202 GC.SuppressFinalize(
this);
205 #region public properties
225 bool changed = zOrder != value;
228 if (changed && !ReferenceEquals(parentSceneLayer,
SceneLayer.Empty))
229 parentSceneLayer.InvalidateFixedGridRenderEligibility();
254 public override Rectangle
DrawLocationWorld => parentSceneLayer.CoordinateSystem.GetPixelRangeForTile(
this,
true);
365 get {
return (animator !=
null); }
370 if (animator ==
null)
381 #endregion public properties
Manages animation playback for a Tile, controlling animation cycles, frame timing,...
Provides collision detection capabilities for a Tile by implementing the ICollider interface.
Represents an abstract base class for drawable tiles in the Gondwana engine. Provides core functional...
virtual Frame CurrentFrame
Gets or sets the current frame. The initial frame supplies the tile's default collision adjustment an...
void AttachCollider(ICollider collider)
Attaches this tile's collider and applies any collision state that was set before the collider became...
ICollider? _collider
The collider.
virtual CollisionAdjust AdjustCollisionArea
Gets or sets the collision adjustment used to derive CollisionArea.
Represents a base class for managing a graphical backbuffer, and is the in-memory surface where rende...
Point GridCoordinatesAbs
Gets the absolute grid coordinates of this tile within its parent scene layer as integer values.
Spacing EffectiveTilePadding
Gets oriented atlas padding for inspection, never for source slicing.
override void Draw(Gondwana.Rendering.Backbuffers.BackbufferBase backbuffer, RectangleF destRectScreen)
Draws the current content into the backbuffer at the supplied screen-pixel bounds.
override SceneLayer SceneLayer
Gets the parent scene layer that contains this tile.
override int ZOrder
Gets the z-order (rendering depth) of this tile within its layer.
override bool IsPositionFixed
Gets a value indicating whether this tile's position is fixed within its grid.
bool EnableAnimator
Gets or sets a value indicating whether the tile's animator is enabled.
TileTransform Transform
Gets or sets this placement's orthogonal orientation without changing its source frame.
override Spacing Overhang
Gets scaled, oriented world-pixel overhang. The source value remains on CurrentFrame.
CollisionAdjust EffectiveCollisionAdjust
Gets the oriented collision insets, including the current frame-derived adjustment.
override Rectangle CollisionArea
Gets the collision area of this entity in world pixel coordinates.
override PointF SceneLayerCoordinates
Gets the grid coordinates of this tile within its parent scene layer as a floating-point value.
override void Dispose()
Releases the resources owned by this instance.
Size EffectiveTileSize
Gets source frame dimensions after placement orientation.
override Rectangle DrawLocationWorld
Gets the world-space pixel rectangle where this tile should be drawn.
TileTransform
The eight orthogonal orientations of artwork placed in a fixed scene cell.
record struct Spacing([property:JsonProperty("left")] int Left, [property:JsonProperty("top")] int Top, [property:JsonProperty("right")] int Right, [property:JsonProperty("bottom")] int Bottom)
Represents dimensions in pixels when spacing Tilesheets.
Per-edge inset amounts applied to visual bounds to produce a collision rectangle.