using CoreGame; using Entitas; namespace CoreGame.Render.System { public class RenderTimerSystem : IExecuteSystem { public void Execute(float deltaTime) { var timer = Contexts.Combat.renderTimer; timer.SyncTimer(); var timerTimerList = timer.timerList; var currTime = GameTime.GetRenderTime(); int ind = 0; for (int i = 0; i < timerTimerList.Count; i++) { if (currTime - timerTimerList[i].initTime >= timerTimerList[i].delayTimeS) { timerTimerList[i].callback?.Invoke(timerTimerList[i].param); } else { if (ind != i) timerTimerList[ind] = timerTimerList[i]; ind++; } } if (ind < timerTimerList.Count) timerTimerList.RemoveRange(ind, timerTimerList.Count - ind); } } }