2019-11-12 08:20:03 +11:00
|
|
|
using Content.Server.GameObjects.Components.Nutrition;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
|
|
|
|
|
2020-08-13 14:40:27 +02:00
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
2019-11-12 08:20:03 +11:00
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
2020-08-13 22:17:12 +10:00
|
|
|
internal sealed class HungerSystem : EntitySystem
|
2019-11-12 08:20:03 +11:00
|
|
|
{
|
|
|
|
|
private float _accumulatedFrameTime;
|
2020-08-13 22:17:12 +10:00
|
|
|
|
2019-11-12 08:20:03 +11:00
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
_accumulatedFrameTime += frameTime;
|
|
|
|
|
if (_accumulatedFrameTime > 1.0f)
|
|
|
|
|
{
|
2020-08-13 22:17:12 +10:00
|
|
|
foreach (var comp in ComponentManager.EntityQuery<HungerComponent>())
|
2019-11-12 08:20:03 +11:00
|
|
|
{
|
|
|
|
|
comp.OnUpdate(_accumulatedFrameTime);
|
|
|
|
|
}
|
2020-08-13 22:17:12 +10:00
|
|
|
_accumulatedFrameTime -= 1.0f;
|
2019-11-12 08:20:03 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|