Syntriax.Engine/Engine.Core/Extensions/TransformExtensions.cs

20 lines
838 B
C#
Raw Permalink Normal View History

2024-01-30 12:57:27 +03:00
using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Core;
public static class TransformExtensions
{
2024-02-06 12:34:18 +03:00
public static ITransform SetTransform(this ITransform transform,
Vector2D? position = null, float? rotation = null, Vector2D? scale = null,
Vector2D? localPosition = null, float? localRotation = null, Vector2D? localScale = null)
2024-01-30 12:57:27 +03:00
{
if (position.HasValue) transform.Position = position.Value;
if (rotation.HasValue) transform.Rotation = rotation.Value;
if (scale.HasValue) transform.Scale = scale.Value;
2024-02-06 12:34:18 +03:00
if (localPosition.HasValue) transform.LocalPosition = localPosition.Value;
if (localRotation.HasValue) transform.LocalRotation = localRotation.Value;
if (localScale.HasValue) transform.LocalScale = localScale.Value;
2024-01-30 12:57:27 +03:00
return transform;
}
}