refactor!: Transform events now send previous values of their changed fields

This commit is contained in:
2025-03-26 14:19:47 +03:00
parent 5fc8c012b3
commit d825bb55d3
3 changed files with 78 additions and 24 deletions

View File

@@ -95,10 +95,46 @@ public interface ITransform : IAssignableGameObject, IEnumerable<ITransform>
/// <param name="transform">The child <see cref="ITransform"/> to remove.</param>
void RemoveChild(ITransform transform);
delegate void OnPositionChangedEventHandler(ITransform sender);
delegate void OnScaleChangedEventHandler(ITransform sender);
delegate void OnRotationChangedEventHandler(ITransform sender);
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform"/>'s rotation changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform"/> that the parent has changed.</param>
/// <param name="previousPosition">The previous <see cref="Position"/> of the <see cref="ITransform"/>.</param>
delegate void OnPositionChangedEventHandler(ITransform sender, Vector2D previousPosition);
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform"/>'s rotation changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform"/> that the parent has changed.</param>
/// <param name="previousScale">The previous <see cref="Scale"/> of the <see cref="ITransform"/>.</param>
delegate void OnScaleChangedEventHandler(ITransform sender, Vector2D previousScale);
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform"/>'s rotation changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform"/> that the parent has changed.</param>
/// <param name="previousRotation">The previous <see cref="Rotation"/> of the <see cref="ITransform"/>.</param>
delegate void OnRotationChangedEventHandler(ITransform sender, float previousRotation);
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform"/>'s parent changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform"/> that the parent has changed.</param>
/// <param name="previousParent">The previous <see cref="ITransform"/> the sender was a child of.</param>
/// <param name="newParent">The new and current <see cref="ITransform"/> the sender is a child of.</param>
delegate void OnParentChangedEventHandler(ITransform sender, ITransform? previousParent, ITransform? newParent);
/// <summary>
/// Delegate for the event triggered when a new <see cref="ITransform"/> added as a child.
/// </summary>
/// <param name="sender">The parent <see cref="ITransform"/> this event is being called from.</param>
/// <param name="childrenAdded">The <see cref="ITransform"/> that got removed as a children of the sender <see cref="ITransform"/>.</param>
delegate void OnChildrenAddedEventHandler(ITransform sender, ITransform childrenAdded);
/// <summary>
/// Delegate for the event triggered when a new <see cref="ITransform"/> removed from being a child.
/// </summary>
/// <param name="sender">The parent <see cref="ITransform"/> this event is being called from.</param>
/// <param name="childrenAdded">The <see cref="ITransform"/> that got removed as a children of the sender <see cref="ITransform"/>.</param>
delegate void OnChildrenRemovedEventHandler(ITransform sender, ITransform childrenRemoved);
}