using System.Collections.Generic; namespace Syntriax.Engine.Core.Abstract; /// /// Represents the transformation properties of an object such as position, scale, and rotation. /// public interface ITransform : IAssignableGameObject, IEnumerable { /// /// Event triggered when the of the changes. /// event OnPositionChangedEventHandler? OnPositionChanged; /// /// Event triggered when the of the changes. /// event OnScaleChangedEventHandler? OnScaleChanged; /// /// Event triggered when the of the changes. /// event OnRotationChangedEventHandler? OnRotationChanged; /// /// Event triggered when the of the changes. The second parameter is the old . /// event OnParentChangedEventHandler? OnParentChanged; /// /// Event triggered when a new is added to the . /// event OnChildrenAddedEventHandler? OnChildrenAdded; /// /// Event triggered when an is removed from the . /// event OnChildrenRemovedEventHandler? OnChildrenRemoved; /// /// The world position of the in 2D space. /// Vector2D Position { get; set; } /// /// The world scale of the . /// Vector2D Scale { get; set; } /// /// The world rotation of the in degrees. /// float Rotation { get; set; } /// /// The local position of the in 2D space. /// Vector2D LocalPosition { get; set; } /// /// The local scale of the . /// Vector2D LocalScale { get; set; } /// /// The local rotation of the in degrees. /// float LocalRotation { get; set; } /// /// The parent of the . /// ITransform? Parent { get; } /// /// The s that have this as their . /// IReadOnlyList Children { get; } /// /// Sets the parent of this . /// /// The parent to set. void SetParent(ITransform? transform); /// /// Adds a child to this . /// /// The child to add. void AddChild(ITransform transform); /// /// Removes a child from this . /// /// The child to remove. void RemoveChild(ITransform transform); /// /// Delegate for the event triggered when the 's rotation changes. /// /// The that the parent has changed. /// The previous of the . delegate void OnPositionChangedEventHandler(ITransform sender, Vector2D previousPosition); /// /// Delegate for the event triggered when the 's rotation changes. /// /// The that the parent has changed. /// The previous of the . delegate void OnScaleChangedEventHandler(ITransform sender, Vector2D previousScale); /// /// Delegate for the event triggered when the 's rotation changes. /// /// The that the parent has changed. /// The previous of the . delegate void OnRotationChangedEventHandler(ITransform sender, float previousRotation); /// /// Delegate for the event triggered when the 's parent changes. /// /// The that the parent has changed. /// The previous the sender was a child of. /// The new and current the sender is a child of. delegate void OnParentChangedEventHandler(ITransform sender, ITransform? previousParent, ITransform? newParent); /// /// Delegate for the event triggered when a new added as a child. /// /// The parent this event is being called from. /// The that got removed as a children of the sender . delegate void OnChildrenAddedEventHandler(ITransform sender, ITransform childrenAdded); /// /// Delegate for the event triggered when a new removed from being a child. /// /// The parent this event is being called from. /// The that got removed as a children of the sender . delegate void OnChildrenRemovedEventHandler(ITransform sender, ITransform childrenRemoved); }