You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
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);
|
|
}
|
|
}
|
|
}
|