fix: added missing types for new primitives
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Tween;
|
||||
|
||||
public static class TweenLine3DExtensions
|
||||
{
|
||||
private static readonly BoxedPool<Line3D> boxedLine3DPool = new(2);
|
||||
|
||||
public static ITween TweenLine3D(this Line3D initialLine3D, ITweenManager tweenManager, float duration, Line3D targetLine3D, System.Action<Line3D> setMethod)
|
||||
{
|
||||
Boxed<Line3D> boxedInitial = boxedLine3DPool.Get(initialLine3D);
|
||||
Boxed<Line3D> boxedTarget = boxedLine3DPool.Get(targetLine3D);
|
||||
|
||||
ITween tween = tweenManager.StartTween(duration,
|
||||
t => setMethod?.Invoke(
|
||||
new Line3D(
|
||||
boxedInitial.Value.From.Lerp(boxedTarget.Value.From, t),
|
||||
boxedInitial.Value.To.Lerp(boxedTarget.Value.To, t)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
tween.OnComplete(() =>
|
||||
{
|
||||
boxedLine3DPool.Return(boxedInitial);
|
||||
boxedLine3DPool.Return(boxedTarget);
|
||||
});
|
||||
|
||||
return tween;
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Tween;
|
||||
|
||||
public static class TweenRay2DExtensions
|
||||
{
|
||||
private static readonly BoxedPool<Ray2D> boxedRay2DPool = new(2);
|
||||
|
||||
public static ITween TweenRay2D(this Ray2D initialRay2D, ITweenManager tweenManager, float duration, Ray2D targetRay2D, System.Action<Ray2D> setMethod)
|
||||
{
|
||||
Boxed<Ray2D> boxedInitial = boxedRay2DPool.Get(initialRay2D);
|
||||
Boxed<Ray2D> boxedTarget = boxedRay2DPool.Get(targetRay2D);
|
||||
|
||||
ITween tween = tweenManager.StartTween(duration,
|
||||
t => setMethod?.Invoke(
|
||||
new Ray2D(
|
||||
boxedInitial.Value.Origin.Lerp(boxedTarget.Value.Origin, t),
|
||||
boxedInitial.Value.Direction.Lerp(boxedTarget.Value.Direction, t).Normalized
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
tween.OnComplete(() =>
|
||||
{
|
||||
boxedRay2DPool.Return(boxedInitial);
|
||||
boxedRay2DPool.Return(boxedTarget);
|
||||
});
|
||||
|
||||
return tween;
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Tween;
|
||||
|
||||
public static class TweenRay3DExtensions
|
||||
{
|
||||
private static readonly BoxedPool<Ray3D> boxedRay3DPool = new(2);
|
||||
|
||||
public static ITween TweenRay3D(this Ray3D initialRay3D, ITweenManager tweenManager, float duration, Ray3D targetRay3D, System.Action<Ray3D> setMethod)
|
||||
{
|
||||
Boxed<Ray3D> boxedInitial = boxedRay3DPool.Get(initialRay3D);
|
||||
Boxed<Ray3D> boxedTarget = boxedRay3DPool.Get(targetRay3D);
|
||||
|
||||
ITween tween = tweenManager.StartTween(duration,
|
||||
t => setMethod?.Invoke(
|
||||
new Ray3D(
|
||||
boxedInitial.Value.Origin.Lerp(boxedTarget.Value.Origin, t),
|
||||
boxedInitial.Value.Direction.Lerp(boxedTarget.Value.Direction, t).Normalized
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
tween.OnComplete(() =>
|
||||
{
|
||||
boxedRay3DPool.Return(boxedInitial);
|
||||
boxedRay3DPool.Return(boxedTarget);
|
||||
});
|
||||
|
||||
return tween;
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Tween;
|
||||
|
||||
public static class TweenVector4DExtensions
|
||||
{
|
||||
private static readonly BoxedPool<Vector4D> boxedVector4DPool = new(2);
|
||||
|
||||
public static ITween TweenVector4D(this Vector4D initialVector4D, ITweenManager tweenManager, float duration, Vector4D targetVector4D, System.Action<Vector4D> setMethod)
|
||||
{
|
||||
Boxed<Vector4D> boxedInitial = boxedVector4DPool.Get(initialVector4D);
|
||||
Boxed<Vector4D> boxedTarget = boxedVector4DPool.Get(targetVector4D);
|
||||
|
||||
ITween tween = tweenManager.StartTween(duration, t => setMethod?.Invoke(boxedInitial.Value.Lerp(boxedTarget.Value, t)));
|
||||
|
||||
tween.OnComplete(() =>
|
||||
{
|
||||
boxedVector4DPool.Return(boxedInitial);
|
||||
boxedVector4DPool.Return(boxedTarget);
|
||||
});
|
||||
|
||||
return tween;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user