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.
 
 
 
 
 
 

41 lines
1.2 KiB

using Entitas;
namespace CoreGame.Render
{
public class StateBarUpdateSystem : IExecuteSystem
{
private readonly IGroup<CombatEntity> 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();
}
}
}
}