<commit_before>﻿using Atlas.Core.Messages;
using Atlas.Core.Objects.Sleep;
using Atlas.Core.Objects.Update;
using Atlas.ECS.Components.Engine;

namespace Atlas.ECS.Systems
{
	public abstract class AtlasSystem : Messenger<ISystem>, ISystem
	{
		#region Fields
		private IEngine engine;
		private readonly Sleep<ISystem> Sleep;
		private int priority = 0;
		private float totalIntervalTime = 0;
		private float deltaIntervalTime = 0;
		private TimeStep timeStep = TimeStep.Variable;
		private TimeStep updateState = TimeStep.None;
		private UpdateLock UpdateLock { get; } = new UpdateLock();
		#endregion

		#region Construct / Dispose
		public AtlasSystem()
		{
			Sleep = new Sleep<ISystem>(this);
		}

		public sealed override void Dispose()
		{
			//Can't dispose System mid-update.
			if(Engine != null || updateState != TimeStep.None)
				return;
			base.Dispose();
		}

		protected override void Disposing()
		{
			Priority = 0;
			Sleeping = 0;
			DeltaIntervalTime = 0;
			TotalIntervalTime = 0;
			UpdateStep = TimeStep.Variable;
			UpdateState = TimeStep.None;<commit_msg>Changed AtlasSystem constructor to be protected.<commit_after>﻿using Atlas.Core.Messages;
using Atlas.Core.Objects.Sleep;
using Atlas.Core.Objects.Update;
using Atlas.ECS.Components.Engine;

namespace Atlas.ECS.Systems
{
	public abstract class AtlasSystem : Messenger<ISystem>, ISystem
	{
		#region Fields
		private IEngine engine;
		private readonly Sleep<ISystem> Sleep;
		private int priority = 0;
		private float totalIntervalTime = 0;
		private float deltaIntervalTime = 0;
		private TimeStep timeStep = TimeStep.Variable;
		private TimeStep updateState = TimeStep.None;
		private UpdateLock UpdateLock { get; } = new UpdateLock();
		#endregion

		#region Construct / Dispose
		protected AtlasSystem()
		{
			Sleep = new Sleep<ISystem>(this);
		}

		public sealed override void Dispose()
		{
			//Can't dispose System mid-update.
			if(Engine != null || updateState != TimeStep.None)
				return;
			base.Dispose();
		}

		protected override void Disposing()
		{
			Priority = 0;
			Sleeping = 0;
			DeltaIntervalTime = 0;
			TotalIntervalTime = 0;
			UpdateStep = TimeStep.Variable;
			UpdateState = TimeStep.None;
{'fraction_non_alphanumeric': 0.095, 'fraction_numerical': 0.006363636363636364, 'mean_word_length': 3.946067415730337, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3364323', 'n_tokens_mistral': 778, 'n_tokens_neox': 645, 'n_words': 186}