This commit is contained in:
Mikhail 2024-04-22 17:09:06 +08:00
parent 089a1ab60a
commit 9a149da66e
2 changed files with 9 additions and 6 deletions

View File

@ -93,7 +93,6 @@ namespace DCFApixels.DragonECS
{
private EcsWorld _world;
private EcsMask.Builder _maskBuilder;
private bool _isBuilt = false;
public IncludeMarker Inc
{
get { return new IncludeMarker(this); }
@ -210,7 +209,6 @@ namespace DCFApixels.DragonECS
private void Build(out EcsMask mask)
{
mask = _maskBuilder.Build();
_isBuilt = true;
}
#region SupportReflectionHack
@ -499,7 +497,7 @@ namespace DCFApixels.DragonECS
foreach (var incTypeID in _mask.inc)
{
var pool = world.GetPoolInstance(incTypeID);
if (pool.Has(entityID) == false)
if (pool != null && pool.Has(entityID) == false)
{
pool.AddRaw(entityID, null);
}
@ -507,7 +505,7 @@ namespace DCFApixels.DragonECS
foreach (var excTypeID in _mask.exc)
{
var pool = world.GetPoolInstance(excTypeID);
if (pool.Has(entityID))
if (pool != null && pool.Has(entityID))
{
pool.Del(entityID);
}

View File

@ -20,10 +20,15 @@ namespace DCFApixels.DragonECS
#region Getters
public IEcsPool GetPoolInstance(int componentTypeID)
{
if (IsComponentTypeDeclared(componentTypeID))
{
var resuult = _pools[componentTypeID];
#if DEBUG
if (_pools[componentTypeID].ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
if (resuult != _nullPool && resuult.ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
#endif
return _pools[componentTypeID];
return resuult;
}
return null;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]