refactor: updated systems to use the update interfaces

This commit is contained in:
2025-06-06 20:15:05 +03:00
parent fbdea47dc7
commit 45524e474e
3 changed files with 12 additions and 60 deletions

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Syntriax.Engine.Core;
public class CoroutineManager : Behaviour
public class CoroutineManager : Behaviour, IUpdate
{
private readonly List<IEnumerator> enumerators = [];
@@ -18,17 +18,7 @@ public class CoroutineManager : Behaviour
enumerators.Remove(enumerator);
}
protected override void OnEnteredUniverse(IUniverse universe)
{
universe.OnUpdate.AddListener(OnUpdate);
}
protected override void OnExitedUniverse(IUniverse universe)
{
universe.OnUpdate.RemoveListener(OnUpdate);
}
private void OnUpdate(IUniverse sender, IUniverse.UpdateArguments args)
void IUpdate.Update()
{
for (int i = enumerators.Count - 1; i >= 0; i--)
{
@@ -39,4 +29,6 @@ public class CoroutineManager : Behaviour
enumerators.RemoveAt(i);
}
}
public CoroutineManager() => Priority = int.MinValue;
}