remove System.Span dependency

This commit is contained in:
DCFApixels 2025-03-15 15:24:44 +08:00
parent 7637fae7cc
commit b5c4a6949e

View File

@ -286,11 +286,6 @@ namespace DCFApixels.DragonECS
} }
CheckUnregisterValid(count, entityID); CheckUnregisterValid(count, entityID);
} }
private Span<int> GetEntityComponentMask(int entityID)
{
return new Span<int>(_entityComponentMasks, entityID << _entityComponentMaskLengthBitShift, _entityComponentMaskLength);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool TryRegisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit) private bool TryRegisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
{ {
@ -336,17 +331,20 @@ namespace DCFApixels.DragonECS
{ {
#if DEBUG #if DEBUG
if (count < 0) { Throw.World_InvalidIncrementComponentsBalance(); } if (count < 0) { Throw.World_InvalidIncrementComponentsBalance(); }
#elif DRAGONECS_STABILITY_MODE //#elif DRAGONECS_STABILITY_MODE
if (count < 0) if (count < 0)
{ {
var mask = GetEntityComponentMask(entityID); for (int i = entityID << _entityComponentMaskLengthBitShift, iMax = i + _entityComponentMaskLength; i < iMax; i++)
for (int i = 0; i < mask.Length; i++) { mask[i] = 0; } {
_entityComponentMasks[i] = 0;
}
//TODO добавить очистку пулов //TODO добавить очистку пулов
_entities[entityID].componentsCount = 0; _entities[entityID].componentsCount = 0;
} }
#endif #endif
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private int GetPoolComponentCount(int componentTypeID) private int GetPoolComponentCount(int componentTypeID)
{ {