mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 17:34:36 +08:00
code cleanup
This commit is contained in:
parent
3c053b2a5e
commit
8e4c6ce552
@ -185,7 +185,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public bool IsCollidingID(string id)
|
public bool IsCollidingID(string id)
|
||||||
{
|
{
|
||||||
if(_collidingIDs== null)
|
if (_collidingIDs == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
for (int i = _emptyEntitiesCount - 1; i >= 0; i--)
|
for (int i = _emptyEntitiesCount - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(_emptyEntities[i] == entityID)
|
if (_emptyEntities[i] == entityID)
|
||||||
{
|
{
|
||||||
_emptyEntities[i] = _emptyEntities[--_emptyEntitiesCount];
|
_emptyEntities[i] = _emptyEntities[--_emptyEntitiesCount];
|
||||||
return true;
|
return true;
|
||||||
@ -856,7 +856,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
_emptyEntitiesCount = 0;
|
_emptyEntitiesCount = 0;
|
||||||
|
|
||||||
if(count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
count = _delEntBufferCount;
|
count = _delEntBufferCount;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ namespace DCFApixels.DragonECS
|
|||||||
slot.count++;
|
slot.count++;
|
||||||
slot.version++;
|
slot.version++;
|
||||||
var count = _entities[entityID].componentsCount++;
|
var count = _entities[entityID].componentsCount++;
|
||||||
if(count == 0 && IsUsed(entityID))
|
if (count == 0 && IsUsed(entityID))
|
||||||
{
|
{
|
||||||
RemoveFromEmptyEntities(entityID);
|
RemoveFromEmptyEntities(entityID);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool TryGetWorld(short worldID, out EcsWorld world)
|
public static bool TryGetWorld(short worldID, out EcsWorld world)
|
||||||
{// ts
|
{// ts
|
||||||
if(worldID >= _worlds.Length)
|
if (worldID >= _worlds.Length)
|
||||||
{
|
{
|
||||||
world = null;
|
world = null;
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,19 +69,19 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
_version++;
|
_version++;
|
||||||
_iterator.IterateTo(World.Entities, _filteredAllGroup);
|
_iterator.IterateTo(World.Entities, _filteredAllGroup);
|
||||||
#if DEBUG && DRAGONECS_DEEP_DEBUG
|
#if DEBUG && DRAGONECS_DEEP_DEBUG
|
||||||
if(_filteredGroup == null)
|
if (_filteredGroup == null)
|
||||||
{
|
{
|
||||||
_filteredGroup = EcsGroup.New(World);
|
_filteredGroup = EcsGroup.New(World);
|
||||||
}
|
}
|
||||||
_filteredGroup.Clear();
|
_filteredGroup.Clear();
|
||||||
foreach (var e in World.Entities)
|
foreach (var e in World.Entities)
|
||||||
{
|
{
|
||||||
if(World.IsMatchesMask(Mask, e))
|
if (World.IsMatchesMask(Mask, e))
|
||||||
{
|
{
|
||||||
_filteredGroup.Add(e);
|
_filteredGroup.Add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(_filteredAllGroup.SetEquals(_filteredGroup) == false)
|
if (_filteredAllGroup.SetEquals(_filteredGroup) == false)
|
||||||
{
|
{
|
||||||
throw new System.InvalidOperationException();
|
throw new System.InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ namespace DCFApixels.DragonECS.Core
|
|||||||
_maskInc = mask._incs;
|
_maskInc = mask._incs;
|
||||||
_maskExc = mask._excs;
|
_maskExc = mask._excs;
|
||||||
_count = 1 + mask._incs.Length + mask._excs.Length;
|
_count = 1 + mask._incs.Length + mask._excs.Length;
|
||||||
|
|
||||||
_versions = UnmanagedArrayUtility.NewAndInit<long>(_count);
|
_versions = UnmanagedArrayUtility.NewAndInit<long>(_count);
|
||||||
}
|
}
|
||||||
public bool Check()
|
public bool Check()
|
||||||
|
@ -538,7 +538,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
state ^= state >> 17;
|
state ^= state >> 17;
|
||||||
state ^= state << 5;
|
state ^= state << 5;
|
||||||
return state;
|
return state;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static long NextXorShiftState(long state)
|
public static long NextXorShiftState(long state)
|
||||||
|
@ -447,7 +447,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void RemoveListener(IEcsPoolEventListener listener) { _pool.AddListener(listener); }
|
public void RemoveListener(IEcsPoolEventListener listener) { _pool.AddListener(listener); }
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Convertors
|
#region Convertors
|
||||||
public static implicit operator ReadonlyEcsPool<T>(EcsPool<T> a) { return new ReadonlyEcsPool<T>(a); }
|
public static implicit operator ReadonlyEcsPool<T>(EcsPool<T> a) { return new ReadonlyEcsPool<T>(a); }
|
||||||
|
Loading…
Reference in New Issue
Block a user