mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2026-04-22 01:45:55 +08:00
Compare commits
No commits in common. "main" and "1.0.0" have entirely different histories.
@ -10,7 +10,7 @@
|
||||
<RootNamespace>DCFApixels.DragonECS</RootNamespace>
|
||||
|
||||
<Title>DragonECS</Title>
|
||||
<Version>1.0.1</Version>
|
||||
<Version>0.9.23</Version>
|
||||
<Authors>DCFApixels</Authors>
|
||||
<Description>ECS Framework for Game Engines with C# and .Net Platform</Description>
|
||||
<Copyright>DCFApixels</Copyright>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"displayName": "DragonECS",
|
||||
"description": "C# Entity Component System Framework",
|
||||
"unity": "2021.2",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DCFApixels/DragonECS.git"
|
||||
|
||||
@ -399,7 +399,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
_entityListeners.InvokeOnNewEntity(entityID);
|
||||
}
|
||||
MoveToEmptyEntities(entityID, false);
|
||||
MoveToEmptyEntities(entityID);
|
||||
}
|
||||
|
||||
|
||||
@ -446,18 +446,10 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void MoveToEmptyEntities(int entityID, bool readyToRemove)
|
||||
private void MoveToEmptyEntities(int entityID)
|
||||
{
|
||||
if (readyToRemove)
|
||||
{
|
||||
entityID |= int.MinValue;
|
||||
}
|
||||
_emptyEntities[_emptyEntitiesLength++] = entityID;
|
||||
_emptyEntitiesCount++;
|
||||
if (_emptyEntitiesLength == _emptyEntities.Length)
|
||||
{
|
||||
ReleaseEmptyEntitiesBuffer_OnlyReadyToRemove();
|
||||
}
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void RemoveFromEmptyEntities(int entityID)
|
||||
@ -469,7 +461,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
for (int i = _emptyEntitiesLength - 1; i >= 0; i--)
|
||||
{
|
||||
if ((_emptyEntities[i] & int.MaxValue) == entityID)
|
||||
if (_emptyEntities[i] == entityID)
|
||||
{
|
||||
_emptyEntities[i] = _emptyEntities[--_emptyEntitiesLength];
|
||||
}
|
||||
@ -488,45 +480,6 @@ namespace DCFApixels.DragonECS
|
||||
_emptyEntitiesLength = 0;
|
||||
}
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ReleaseEmptyEntitiesBuffer()
|
||||
{
|
||||
for (int i = 0; i < _emptyEntitiesLength; i++)
|
||||
{
|
||||
var entityID = _emptyEntities[i] & int.MaxValue;
|
||||
if (IsUsed(entityID) && _entities[entityID].componentsCount == 0)
|
||||
{
|
||||
DelEntity(entityID);
|
||||
}
|
||||
}
|
||||
_emptyEntitiesCount = 0;
|
||||
_emptyEntitiesLength = 0;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void ReleaseEmptyEntitiesBuffer_OnlyReadyToRemove()
|
||||
{
|
||||
var newCount = 0;
|
||||
for (int i = 0; i < _emptyEntitiesLength; i++)
|
||||
{
|
||||
var entityID = _emptyEntities[i];
|
||||
bool isReady = entityID < 0;
|
||||
entityID &= int.MaxValue;
|
||||
|
||||
if (IsUsed(entityID) && _entities[entityID].componentsCount == 0)
|
||||
{
|
||||
if (isReady)
|
||||
{
|
||||
DelEntity(entityID);
|
||||
}
|
||||
else
|
||||
{
|
||||
_emptyEntities[newCount++] = entityID;
|
||||
}
|
||||
}
|
||||
}
|
||||
_emptyEntitiesCount = newCount;
|
||||
_emptyEntitiesLength = newCount;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
@ -966,7 +919,16 @@ namespace DCFApixels.DragonECS
|
||||
if (_emptyEntitiesLength <= 0 && _delEntBufferCount <= 0) { return; }
|
||||
unchecked { _version++; }
|
||||
|
||||
ReleaseEmptyEntitiesBuffer();
|
||||
for (int i = 0; i < _emptyEntitiesLength; i++)
|
||||
{
|
||||
var entityID = _emptyEntities[i];
|
||||
if (IsUsed(entityID) && _entities[entityID].componentsCount == 0)
|
||||
{
|
||||
DelEntity(entityID);
|
||||
}
|
||||
}
|
||||
_emptyEntitiesCount = 0;
|
||||
_emptyEntitiesLength = 0;
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
|
||||
@ -302,7 +302,7 @@ namespace DCFApixels.DragonECS
|
||||
_entityComponentMasks[(entityID << _entityComponentMaskLengthBitShift) + maskBit.chunkIndex] &= ~maskBit.mask;
|
||||
if (count == 0 && IsUsed(entityID))
|
||||
{
|
||||
MoveToEmptyEntities(entityID, true);
|
||||
MoveToEmptyEntities(entityID);
|
||||
}
|
||||
CheckUnregisterValid(count, entityID);
|
||||
if (_hasAnyEntityListener)
|
||||
@ -351,7 +351,7 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
if (count == 0 && IsUsed(entityID))
|
||||
{
|
||||
MoveToEmptyEntities(entityID, true);
|
||||
MoveToEmptyEntities(entityID);
|
||||
}
|
||||
CheckUnregisterValid(count, entityID);
|
||||
if (_hasAnyEntityListener)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user