mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
remove comments
This commit is contained in:
parent
a3a61d21da
commit
c7b8246e09
@ -33,8 +33,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private IdDispenser _entityDispenser;
|
private IdDispenser _entityDispenser;
|
||||||
private int _entitiesCount = 0;
|
private int _entitiesCount = 0;
|
||||||
private int _entitiesCapacity = 0;
|
private int _entitiesCapacity = 0;
|
||||||
//private short[] _gens = Array.Empty<short>(); //старший бит указывает на то жива ли сущность
|
|
||||||
//private short[] _componentCounts = Array.Empty<short>();
|
|
||||||
private EntitySlot[] _entities = Array.Empty<EntitySlot>();
|
private EntitySlot[] _entities = Array.Empty<EntitySlot>();
|
||||||
|
|
||||||
private int[] _delEntBuffer = Array.Empty<int>();
|
private int[] _delEntBuffer = Array.Empty<int>();
|
||||||
@ -154,8 +152,6 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
_entityDispenser = null;
|
_entityDispenser = null;
|
||||||
//_gens = null;
|
|
||||||
//_componentCounts = null;
|
|
||||||
_pools = null;
|
_pools = null;
|
||||||
_nullPool = null;
|
_nullPool = null;
|
||||||
_worlds[id] = null;
|
_worlds[id] = null;
|
||||||
@ -231,11 +227,8 @@ namespace DCFApixels.DragonECS
|
|||||||
_entitiesCount++;
|
_entitiesCount++;
|
||||||
if (_entitiesCapacity <= entityID)
|
if (_entitiesCapacity <= entityID)
|
||||||
{
|
{
|
||||||
//OnEntityDispenserResized(_gens.Length << 1);
|
|
||||||
OnEntityDispenserResized(_entities.Length << 1);
|
OnEntityDispenserResized(_entities.Length << 1);
|
||||||
}
|
}
|
||||||
//_gens[entityID] &= GEN_MASK;
|
|
||||||
//_entities[entityID].gen &= GEN_MASK;
|
|
||||||
_entities[entityID].isUsed = true;
|
_entities[entityID].isUsed = true;
|
||||||
_entityListeners.InvokeOnNewEntity(entityID);
|
_entityListeners.InvokeOnNewEntity(entityID);
|
||||||
}
|
}
|
||||||
@ -262,7 +255,6 @@ namespace DCFApixels.DragonECS
|
|||||||
#endif
|
#endif
|
||||||
UpVersion();
|
UpVersion();
|
||||||
_delEntBuffer[_delEntBufferCount++] = entityID;
|
_delEntBuffer[_delEntBufferCount++] = entityID;
|
||||||
//_gens[entityID] |= DEATH_GEN_BIT;
|
|
||||||
_entities[entityID].isUsed = false;
|
_entities[entityID].isUsed = false;
|
||||||
_entitiesCount--;
|
_entitiesCount--;
|
||||||
_entityListeners.InvokeOnDelEntity(entityID);
|
_entityListeners.InvokeOnDelEntity(entityID);
|
||||||
@ -288,20 +280,17 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe EntitySlotInfo GetEntitySlotInfoDebug(int entityID)
|
public unsafe EntitySlotInfo GetEntitySlotInfoDebug(int entityID)
|
||||||
{
|
{
|
||||||
//return new EntitySlotInfo(entityID, _gens[entityID], id);
|
|
||||||
return new EntitySlotInfo(entityID, _entities[entityID].gen, id);
|
return new EntitySlotInfo(entityID, _entities[entityID].gen, id);
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool IsAlive(int entityID, short gen)
|
public bool IsAlive(int entityID, short gen)
|
||||||
{
|
{
|
||||||
//ref short slotGen = ref _gens[entityID];
|
|
||||||
ref var slot = ref _entities[entityID];
|
ref var slot = ref _entities[entityID];
|
||||||
return slot.gen == gen && slot.isUsed;
|
return slot.gen == gen && slot.isUsed;
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool IsUsed(int entityID)
|
public bool IsUsed(int entityID)
|
||||||
{
|
{
|
||||||
//return _entityDispenser.IsUsed(entityID);
|
|
||||||
return _entities[entityID].isUsed;
|
return _entities[entityID].isUsed;
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@ -309,7 +298,6 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
//ref short slotGen = ref _gens[entityID];
|
|
||||||
ref short slotGen = ref _entities[entityID].gen;
|
ref short slotGen = ref _entities[entityID].gen;
|
||||||
if (slotGen < 0)
|
if (slotGen < 0)
|
||||||
{ //up gen
|
{ //up gen
|
||||||
@ -323,7 +311,6 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public short GetComponentsCount(int entityID)
|
public short GetComponentsCount(int entityID)
|
||||||
{
|
{
|
||||||
//return _componentCounts[entityID];
|
|
||||||
return _entities[entityID].componentsCount;
|
return _entities[entityID].componentsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +347,6 @@ namespace DCFApixels.DragonECS
|
|||||||
int delCount = 0;
|
int delCount = 0;
|
||||||
foreach (var e in Entities)
|
foreach (var e in Entities)
|
||||||
{
|
{
|
||||||
//if (_componentCounts[e] <= 0)
|
|
||||||
if (_entities[e].componentsCount <= 0)
|
if (_entities[e].componentsCount <= 0)
|
||||||
{
|
{
|
||||||
DelEntity(e);
|
DelEntity(e);
|
||||||
@ -383,7 +369,6 @@ namespace DCFApixels.DragonECS
|
|||||||
int delCount = 0;
|
int delCount = 0;
|
||||||
foreach (var e in Entities)
|
foreach (var e in Entities)
|
||||||
{
|
{
|
||||||
//if (_componentCounts[e] <= 0)
|
|
||||||
if (_entities[e].componentsCount <= 0)
|
if (_entities[e].componentsCount <= 0)
|
||||||
{
|
{
|
||||||
delCount++;
|
delCount++;
|
||||||
@ -483,7 +468,6 @@ namespace DCFApixels.DragonECS
|
|||||||
for (int i = 0; i < slisedCount; i++)
|
for (int i = 0; i < slisedCount; i++)
|
||||||
{
|
{
|
||||||
int e = _delEntBuffer[i];
|
int e = _delEntBuffer[i];
|
||||||
//if (_componentCounts[e] <= 0)
|
|
||||||
if (_entities[e].componentsCount <= 0)
|
if (_entities[e].componentsCount <= 0)
|
||||||
{
|
{
|
||||||
int tmp = _delEntBuffer[i];
|
int tmp = _delEntBuffer[i];
|
||||||
@ -508,8 +492,6 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
int e = buffer[i];
|
int e = buffer[i];
|
||||||
_entityDispenser.Release(e);
|
_entityDispenser.Release(e);
|
||||||
//unchecked { _gens[e]++; }//up gen
|
|
||||||
//_gens[e] |= DEATH_GEN_BIT;
|
|
||||||
_entities[e].gen |= SLEEPING_GEN_FLAG;
|
_entities[e].gen |= SLEEPING_GEN_FLAG;
|
||||||
}
|
}
|
||||||
Densify();
|
Densify();
|
||||||
@ -528,14 +510,11 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
private void OnEntityDispenserResized(int newSize)
|
private void OnEntityDispenserResized(int newSize)
|
||||||
{
|
{
|
||||||
//Array.Resize(ref _gens, newSize);
|
|
||||||
//Array.Resize(ref _componentCounts, newSize);
|
|
||||||
Array.Resize(ref _entities, newSize);
|
Array.Resize(ref _entities, newSize);
|
||||||
Array.Resize(ref _delEntBuffer, newSize);
|
Array.Resize(ref _delEntBuffer, newSize);
|
||||||
_entityComponentMaskLength = _pools.Length / COMPONENT_MATRIX_MASK_BITSIZE + 1;
|
_entityComponentMaskLength = _pools.Length / COMPONENT_MATRIX_MASK_BITSIZE + 1;
|
||||||
Array.Resize(ref _entityComponentMasks, newSize * _entityComponentMaskLength);
|
Array.Resize(ref _entityComponentMasks, newSize * _entityComponentMaskLength);
|
||||||
|
|
||||||
//ArrayUtility.Fill(_gens, DEATH_GEN_BIT, _entitiesCapacity);
|
|
||||||
ArrayUtility.Fill(_entities, EntitySlot.Empty, _entitiesCapacity);
|
ArrayUtility.Fill(_entities, EntitySlot.Empty, _entitiesCapacity);
|
||||||
|
|
||||||
_entitiesCapacity = newSize;
|
_entitiesCapacity = newSize;
|
||||||
|
@ -210,7 +210,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private void RegisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
|
private void RegisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
|
||||||
{
|
{
|
||||||
_poolComponentCounts[componentTypeID]++;
|
_poolComponentCounts[componentTypeID]++;
|
||||||
//_componentCounts[entityID]++;
|
|
||||||
_entities[entityID].componentsCount++;
|
_entities[entityID].componentsCount++;
|
||||||
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] |= maskBit.mask;
|
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] |= maskBit.mask;
|
||||||
}
|
}
|
||||||
@ -218,7 +217,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private void UnregisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
|
private void UnregisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
|
||||||
{
|
{
|
||||||
_poolComponentCounts[componentTypeID]--;
|
_poolComponentCounts[componentTypeID]--;
|
||||||
//var count = --_componentCounts[entityID];
|
|
||||||
var count = --_entities[entityID].componentsCount;
|
var count = --_entities[entityID].componentsCount;
|
||||||
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] &= ~maskBit.mask;
|
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] &= ~maskBit.mask;
|
||||||
|
|
||||||
@ -241,7 +239,6 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
chunk = newChunk;
|
chunk = newChunk;
|
||||||
_poolComponentCounts[componentTypeID]++;
|
_poolComponentCounts[componentTypeID]++;
|
||||||
//_componentCounts[entityID]++;
|
|
||||||
_entities[entityID].componentsCount++;
|
_entities[entityID].componentsCount++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -255,7 +252,6 @@ namespace DCFApixels.DragonECS
|
|||||||
if (chunk != newChunk)
|
if (chunk != newChunk)
|
||||||
{
|
{
|
||||||
_poolComponentCounts[componentTypeID]--;
|
_poolComponentCounts[componentTypeID]--;
|
||||||
//var count = --_componentCounts[entityID];
|
|
||||||
var count = --_entities[entityID].componentsCount;
|
var count = --_entities[entityID].componentsCount;
|
||||||
chunk = newChunk;
|
chunk = newChunk;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user