From 29a7f5880f83102aeb9ff8f5a0277193cc930b81 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 9 Jun 2025 18:59:15 +0300 Subject: [PATCH] feat: transform up, down, left & right properties added --- Engine.Core/Abstract/ITransform2D.cs | 20 ++++++++++++++++++++ Engine.Core/Transform2D.cs | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/Engine.Core/Abstract/ITransform2D.cs b/Engine.Core/Abstract/ITransform2D.cs index b0175fa..495ef9e 100644 --- a/Engine.Core/Abstract/ITransform2D.cs +++ b/Engine.Core/Abstract/ITransform2D.cs @@ -20,6 +20,26 @@ public interface ITransform2D : IBehaviour /// Event OnRotationChanged { get; } + /// + /// The pointing upwards in world space. + /// + Vector2D Up { get; } + + /// + /// The pointing upwards in world space. + /// + Vector2D Down { get; } + + /// + /// The pointing upwards in world space. + /// + Vector2D Left { get; } + + /// + /// The pointing upwards in world space. + /// + Vector2D Right { get; } + /// /// The world position of the in 2D space. /// diff --git a/Engine.Core/Transform2D.cs b/Engine.Core/Transform2D.cs index fa50bb9..7d14fa9 100644 --- a/Engine.Core/Transform2D.cs +++ b/Engine.Core/Transform2D.cs @@ -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;