refactor: updated systems to use the update interfaces
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user