TODO solving

This commit is contained in:
Mikhail 2024-03-02 21:59:02 +08:00
parent c64ffe41f0
commit 9708b29020
4 changed files with 20 additions and 6 deletions

View File

@ -204,11 +204,11 @@ namespace DCFApixels.DragonECS
{
return world.GetFreeGroup();
}
internal EcsGroup(EcsWorld world, int denseCapacity = 64)
internal EcsGroup(EcsWorld world, int denseCapacity)
{
_source = world;
_source.RegisterGroup(this);
_dense = new int[denseCapacity]; //TODO добавить в конфиг мира значение
_dense = new int[denseCapacity];
_sparse = new int[world.Capacity];
}
public void Dispose()

View File

@ -129,6 +129,20 @@ namespace DCFApixels.DragonECS
// return self.GetOrDefault(RECYCLED_ENTITIES_CAPACITY, self.Get_EntitiesCapacity() / 2);
//}
private const string GROUP_CAPACITY = nameof(GROUP_CAPACITY);
private const int GROUP_CAPACITY_DEFAULT = 512;
public static TConfig Set_GroupCapacity<TConfig>(this TConfig self, int value)
where TConfig : IEcsWorldConfigWriter
{
self.Set(GROUP_CAPACITY, value);
return self;
}
public static int Get_GroupCapacity(this IEcsWorldConfig self)
{
return self.GetOrDefault(GROUP_CAPACITY, GROUP_CAPACITY_DEFAULT);
}
private const string POOLS_CAPACITY = nameof(POOLS_CAPACITY);
private const int POOLS_CAPACITY_DEFAULT = 512;
public static TConfig Set_PoolsCapacity<TConfig>(this TConfig self, int value)

View File

@ -93,15 +93,15 @@ namespace DCFApixels.DragonECS
#endregion
#region Checks
public bool IsSubmaskOf(EcsMask otherMask) //TODO протестить
public bool IsSubmaskOf(EcsMask otherMask)
{
return IsSubmask(otherMask, this);
}
public bool IsSupermaskOf(EcsMask otherMask) //TODO протестить
public bool IsSupermaskOf(EcsMask otherMask)
{
return IsSubmask(this, otherMask);
}
public bool IsConflictWith(EcsMask otherMask) //TODO протестить
public bool IsConflictWith(EcsMask otherMask)
{
return OverlapsArray(inc, otherMask.exc) || OverlapsArray(exc, otherMask.inc);
}

View File

@ -563,7 +563,7 @@ namespace DCFApixels.DragonECS
}
internal EcsGroup GetFreeGroup()
{
EcsGroup result = _groupsPool.Count <= 0 ? new EcsGroup(this) : _groupsPool.Pop();
EcsGroup result = _groupsPool.Count <= 0 ? new EcsGroup(this, _config.Get_GroupCapacity()) : _groupsPool.Pop();
result._isReleased = false;
return result;
}