// ReSharper disable ForCanBeConvertedToForeach

using NBC.Entitas;
using NBC.Entitas.Interface;
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
using UnityEngine;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
namespace NBC
{
    public sealed class TimerComponentUpdateSystem : UpdateSystem<TimerComponent>
    {
        protected override void Update(TimerComponent self)
        {
            self.Update();
        }
    }

    /// <summary>
    /// 时间调度组件
    /// </summary>
    public sealed class TimerComponent : Entity
    {
        /// <summary>
        /// 使用系统时间创建的计时器核心。
        /// </summary>
        public TimerSchedulerNet Net { get; private set; }

        /// <summary>
        /// 使用 Unity 时间创建的计时器核心。
        /// </summary>
        public TimerSchedulerNetUnity Unity { get; private set; }

        internal TimerComponent Initialize()
        {
            Net = new TimerSchedulerNet(Scene);
            Unity = new TimerSchedulerNetUnity(Scene);
            return this;
        }
        public void Update()
        {
            Net.Update();
            Unity.Update();
        }
    }
}