using Entitas; namespace CoreGame.Render { public class StateBarUpdateSystem : IExecuteSystem { private readonly IGroup m_StateBarGroup; public StateBarUpdateSystem(Contexts contexts) { m_StateBarGroup = contexts.combat.GetGroup(CombatMatcher.StateBarProxy); } public void Execute(float deltaTime) { var ces = m_StateBarGroup.GetEntities(Contexts.s_CacheEntities); for (var i = 0; i < ces.Count; i++) { var stateBar = ces[i].stateBarProxy; var render = stateBar.render; if (!render) continue; if (render.hideDefault) { if (stateBar.stateBarShowTime > 0.001f) { stateBar.stateBarShowTime -= deltaTime; stateBar.ShowStateBar(true); } else { stateBar.ShowStateBar(false); } } stateBar.hpBar?.UpdateRedHpBar(); stateBar.ammoBar?.UpdateGreyAmmoBar(deltaTime); stateBar.UpdatePickUpProgress(); } } } }