chore: renamed tween manager queue to pool for better readability
This commit is contained in:
parent
1acc8bdb8f
commit
6adc002f1a
@ -8,9 +8,9 @@ namespace Syntriax.Engine.Systems.Tween;
|
|||||||
public class TweenManager : UniverseObject, ITweenManager
|
public class TweenManager : UniverseObject, ITweenManager
|
||||||
{
|
{
|
||||||
private CoroutineManager coroutineManager = null!;
|
private CoroutineManager coroutineManager = null!;
|
||||||
private readonly Queue<Tween> queue = new();
|
|
||||||
|
|
||||||
private readonly Dictionary<ITween, IEnumerator> runningCoroutines = [];
|
private readonly Dictionary<ITween, IEnumerator> runningCoroutines = [];
|
||||||
|
private readonly Queue<Tween> pool = new();
|
||||||
|
|
||||||
public ITween StartTween(float duration, ITweenManager.TweenSetCallback? setCallback = null)
|
public ITween StartTween(float duration, ITweenManager.TweenSetCallback? setCallback = null)
|
||||||
{
|
{
|
||||||
@ -22,7 +22,7 @@ public class TweenManager : UniverseObject, ITweenManager
|
|||||||
|
|
||||||
private Tween Get(float duration)
|
private Tween Get(float duration)
|
||||||
{
|
{
|
||||||
if (!queue.TryDequeue(out Tween? result))
|
if (!pool.TryDequeue(out Tween? result))
|
||||||
result = new(duration);
|
result = new(duration);
|
||||||
|
|
||||||
result.Duration = duration;
|
result.Duration = duration;
|
||||||
@ -31,11 +31,11 @@ public class TweenManager : UniverseObject, ITweenManager
|
|||||||
|
|
||||||
private void Return(Tween tween)
|
private void Return(Tween tween)
|
||||||
{
|
{
|
||||||
if (queue.Contains(tween))
|
if (pool.Contains(tween))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tween.Wipe();
|
tween.Wipe();
|
||||||
queue.Enqueue(tween);
|
pool.Enqueue(tween);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator RunTween(Tween tween)
|
private IEnumerator RunTween(Tween tween)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user