using System; using System.Collections; using System.Collections.Generic; using System.Threading; using BITKit; using BITKit.Entities; using UnityEngine; namespace BITFALL.Player.Survival { [CustomType(typeof(IPlayerSurvivalService))] public class PlayerSurvivalService : EntityComponent, IPlayerSurvivalService { public IPlayerSurvivalElement[] Elements { get; set; } = Array.Empty(); [SerializeReference, SubclassSelector] private IPlayerSurvivalElement[] initialElements = Array.Empty(); private IntervalUpdate _interval = new(1); public override void OnAwake() { Elements = initialElements; } public override void OnUpdate(float deltaTime) { if (_interval.AllowUpdate is false) return; foreach (var x in Elements) { x.Value -= 1; } } } }