update pool ClaerAll methods

This commit is contained in:
DCFApixels 2024-12-18 16:18:30 +08:00
parent fb23398853
commit 76a6a113fc
2 changed files with 4 additions and 2 deletions

View File

@ -215,9 +215,10 @@ namespace DCFApixels.DragonECS
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
var span = _source.Where(out SingleAspect<EcsPool<T>> _);
_recycledItemsCount = 0; // спереди потому чтобы обнулялось, так как Del не обнуляет
if (_itemsCount <= 0) { return; }
_itemsCount = 0;
_recycledItemsCount = 0;
var span = _source.Where(out SingleAspect<EcsPool<T>> _);
foreach (var entityID in span)
{
ref int itemIndex = ref _mapping[entityID];

View File

@ -184,6 +184,7 @@ namespace DCFApixels.DragonECS
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
if (_count <= 0) { return; }
var span = _source.Where(out SingleAspect<EcsTagPool<T>> _);
_count = 0;
foreach (var entityID in span)