feat: transform up, down, left & right properties added

This commit is contained in:
Syntriax 2025-06-09 18:59:15 +03:00
parent eee3056614
commit 29a7f5880f
2 changed files with 25 additions and 0 deletions

View File

@ -20,6 +20,26 @@ public interface ITransform2D : IBehaviour
/// </summary>
Event<ITransform2D, RotationChangedArguments> OnRotationChanged { get; }
/// <summary>
/// The <see cref="Vector2D"/> pointing upwards in world space.
/// </summary>
Vector2D Up { get; }
/// <summary>
/// The <see cref="Vector2D"/> pointing upwards in world space.
/// </summary>
Vector2D Down { get; }
/// <summary>
/// The <see cref="Vector2D"/> pointing upwards in world space.
/// </summary>
Vector2D Left { get; }
/// <summary>
/// The <see cref="Vector2D"/> pointing upwards in world space.
/// </summary>
Vector2D Right { get; }
/// <summary>
/// The world position of the <see cref="ITransform2D"/> in 2D space.
/// </summary>

View File

@ -19,6 +19,11 @@ public class Transform2D : Behaviour, ITransform2D
private ITransform2D? parentTransform = null;
public Vector2D Up => Vector2D.Up.Rotate(Rotation * Math.DegreeToRadian);
public Vector2D Down => Vector2D.Down.Rotate(Rotation * Math.DegreeToRadian);
public Vector2D Left => Vector2D.Left.Rotate(Rotation * Math.DegreeToRadian);
public Vector2D Right => Vector2D.Right.Rotate(Rotation * Math.DegreeToRadian);
public Vector2D Position
{
get => _position;