Update AutoEntityCreator.cs

This commit is contained in:
Mikhail 2024-10-31 19:13:10 +08:00
parent e5f44eb23a
commit e7ff0685bb

View File

@ -60,23 +60,20 @@ namespace DCFApixels.DragonECS
} }
private void CreateEntity() private void CreateEntity()
{ {
if (_created) if (_created) { return; }
{
return;
}
if (_world == null) if (_world == null)
{ {
AutoResolveWorldProviderDependensy(); AutoResolveWorldProviderDependensy();
} }
else
{ InitConnect(_connect, _world.GetRaw());
InitConnect(_connect, _world.GetRaw());
}
_created = true; _created = true;
} }
private void InitConnect(EcsEntityConnect connect, EcsWorld world) private void InitConnect(EcsEntityConnect connect, EcsWorld world)
{ {
if (connect.IsConnected) { return; }
connect.ConnectWith(CreateEntity(world), true); connect.ConnectWith(CreateEntity(world), true);
} }
protected virtual entlong CreateEntity(EcsWorld world) protected virtual entlong CreateEntity(EcsWorld world)