mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
optimize EcsGroup.Clear & EcsGroup.Inverse
This commit is contained in:
parent
683da38b77
commit
02a0fc02f9
@ -303,11 +303,11 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_count = 0;
|
for (int i = 0; i < _count; i++)
|
||||||
for (int i = 0; i < _sparse.Length; i++)
|
|
||||||
{
|
{
|
||||||
_sparse[i] = 0;
|
_sparse[_dense[i]] = 0;
|
||||||
}
|
}
|
||||||
|
_count = 0;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -510,6 +510,14 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Inverse
|
#region Inverse
|
||||||
public void Inverse()
|
public void Inverse()
|
||||||
{
|
{
|
||||||
|
if(_count == 0)
|
||||||
|
{
|
||||||
|
foreach (var entityID in _source.Entities)
|
||||||
|
{
|
||||||
|
Add_Internal(entityID);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
foreach (var entityID in _source.Entities)
|
foreach (var entityID in _source.Entities)
|
||||||
{
|
{
|
||||||
if (Has(entityID))
|
if (Has(entityID))
|
||||||
|
Loading…
Reference in New Issue
Block a user