github PixeyeHQ/actors.unity 2019.9.15a
Actors Framework

latest releases: 2020.06.5, 2020.06.4, 2020.06.3...
5 years ago

ENG
Breaking changes & Improvements:

  • The boilerplate code for components transferred from
	static partial class Components
	{
		public const string Health = "Pixeye.Source.ComponentHealth";

		[RuntimeInitializeOnLoadMethod]
		static void ComponentHealthInit() => new SComponentHealth();

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static ref ComponentHealth ComponentHealth(in this ent entity)
			=> ref Storage<ComponentHealth>.components[entity.id];

		internal class SComponentHealth : Storage<ComponentHealth>.Setup
		{
			public override ComponentHealth Create() => new ComponentHealth();
			public override void Dispose(int[] id, int len)
			{
				for (int i = 0; i < len; i++)
				{
					ref var component = ref components[id[i]];
					component.val    = 0;
					component.valMax = 0;
				}
			}
		}
	}

to

static partial class component
	{
		public const string health = "Pixeye.Source.ComponentHealth";

		public static ref ComponentHealth ComponentHealth(in this ent entity)
			=> ref StorageComponentHealth.components[entity.id];
	}

	sealed class StorageComponentHealth : Storage<ComponentHealth>
	{
		public override ComponentHealth Create() => new ComponentHealth();
		public override void Dispose()
		{
			for (int i = 0; i < disposedLen; i++)
			{
				ref var component = ref components[disposed[i]];
				component.val = 0;
				component.valMax = 0;
			}
		}
	}
  • [GroupWantEvent] attribute changed to [WantEvent]

  • [GroupExclude] attribute changed to [Exclude]

  • You can gain slightly better performance at project initialization by defining a namespace you use for your components in the framework settings file. ```SettingsFramework.json````

{
  "SizeEntities": 1024, // initial size of entity arrays
  "SizeComponents": 256, // how many components can be registered
  "SizeGenerations": 4, // you don't need to change anything
  "SizeProcessors": 64, // how many processors you want
  "DataNamespace": "Pixeye.Source" // define Assembly Definition that you use in your components. (optional)
}

RU
Изменения и улучшения

  • Настроечный код изменен с
	static partial class Components
	{
		public const string Health = "Pixeye.Source.ComponentHealth";

		[RuntimeInitializeOnLoadMethod]
		static void ComponentHealthInit() => new SComponentHealth();

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static ref ComponentHealth ComponentHealth(in this ent entity)
			=> ref Storage<ComponentHealth>.components[entity.id];

		internal class SComponentHealth : Storage<ComponentHealth>.Setup
		{
			public override ComponentHealth Create() => new ComponentHealth();
			public override void Dispose(int[] id, int len)
			{
				for (int i = 0; i < len; i++)
				{
					ref var component = ref components[id[i]];
					component.val    = 0;
					component.valMax = 0;
				}
			}
		}
	}

на

static partial class component
	{
		public const string health = "Pixeye.Source.ComponentHealth";

		public static ref ComponentHealth ComponentHealth(in this ent entity)
			=> ref StorageComponentHealth.components[entity.id];
	}

	sealed class StorageComponentHealth : Storage<ComponentHealth>
	{
		public override ComponentHealth Create() => new ComponentHealth();
		public override void Dispose()
		{
			for (int i = 0; i < disposedLen; i++)
			{
				ref var component = ref components[disposed[i]];
				component.val = 0;
				component.valMax = 0;
			}
		}
	}
  • [GroupWantEvent] атрибут изменен на [WantEvent]

  • [GroupExclude] атрибут изменен на [Exclude]

  • Инициализацию проекта на старте можно ускорить настроив файл ```SettingsFramework.json````
    ( находится в ресурсах, если нет то создайте вручную )

{
  "SizeEntities": 1024, // стартовое кол-во сущностей
  "SizeComponents": 256, // кол-во компонентов
  "SizeGenerations": 4, // кол-во поколений компонентов ( скорее все вам непонадобится это менять )
  "SizeProcessors": 64,  // кол-во процессоров
  "DataNamespace": "Pixeye.Source" // Название Assembly Definition библиотеки в которой лежат компоненты
}

Don't miss a new actors.unity release

NewReleases is sending notifications on new releases.