mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
refactoring
This commit is contained in:
parent
53b7fae2c4
commit
1ed1782e4a
@ -269,22 +269,13 @@ namespace DCFApixels.DragonECS
|
|||||||
get => _source.World.GetEntity(_dense[_index]);
|
get => _source.World.GetEntity(_dense[_index]);
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool MoveNext()
|
public bool MoveNext() => ++_index <= _count && _count<_dense.Length; // <= потму что отсчет начинается с индекса 1 //_count < _dense.Length дает среде понять что проверки на выход за границы не нужны
|
||||||
{
|
|
||||||
// <= потму что отсчет начинается с индекса 1
|
|
||||||
return ++_index <= _count && _count < _dense.Length; //_count < _dense.Length дает среде понять что проверки на выход за границы не нужны
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Dispose()
|
public void Dispose() => _source.Unlock();
|
||||||
{
|
|
||||||
_source.Unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class EcsGroupExtensions
|
public static class EcsGroupExtensions
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
@ -5,27 +5,14 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public interface IEcsQuery
|
public abstract class EcsQueryBase
|
||||||
{
|
|
||||||
internal void AddEntity(int entityID);
|
|
||||||
internal void RemoveEntity(int entityID);
|
|
||||||
public EcsQueryMask Mask { get; }
|
|
||||||
}
|
|
||||||
public abstract class EcsQueryBase : IEcsQuery
|
|
||||||
{
|
{
|
||||||
internal EcsGroup group;
|
internal EcsGroup group;
|
||||||
internal EcsQueryMask mask;
|
internal EcsQueryMask mask;
|
||||||
|
|
||||||
public EcsQueryMask Mask => mask;
|
|
||||||
|
|
||||||
public void AddEntity(int entityID) => group.Add(entityID);
|
|
||||||
public void RemoveEntity(int entityID) => group.Remove(entityID);
|
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void IEcsQuery.AddEntity(int entityID) => group.Add(entityID);
|
internal void AddEntity(int entityID) => group.Add(entityID);
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
void IEcsQuery.RemoveEntity(int entityID) => group.Remove(entityID);
|
internal void RemoveEntity(int entityID) => group.Remove(entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class EcsQuery<TWorldArchetype> : EcsQueryBase
|
public abstract class EcsQuery<TWorldArchetype> : EcsQueryBase
|
||||||
@ -51,7 +38,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private List<int> _inc;
|
private List<int> _inc;
|
||||||
private List<int> _exc;
|
private List<int> _exc;
|
||||||
|
|
||||||
internal static TQuery Build<TQuery>(IEcsWorld world) where TQuery : IEcsQuery
|
internal static TQuery Build<TQuery>(IEcsWorld world) where TQuery : EcsQueryBase
|
||||||
{
|
{
|
||||||
Builder builder = new Builder(world);
|
Builder builder = new Builder(world);
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
/* public interface IEcsRealationTable : IEcsReadonlyTable
|
public interface IEcsRealationTable
|
||||||
{
|
{
|
||||||
public EcsFilter Relations<TComponent>() where TComponent : struct;
|
|
||||||
rr
|
|
||||||
}
|
}
|
||||||
public sealed class EcsRelationTable<TWorldArchetype> : IEcsRealationTable
|
internal class EcsRelationWorld<TRelationTableArhetype> : EcsWorld<EcsRelationWorld<TRelationTableArhetype>>
|
||||||
where TWorldArchetype : EcsRelationTableArchetypeBase
|
where TRelationTableArhetype : EcsRelationTableArchetypeBase { }
|
||||||
|
public sealed class EcsRelationTable<TTableArhetype> : IEcsRealationTable
|
||||||
|
where TTableArhetype : EcsRelationTableArchetypeBase
|
||||||
{
|
{
|
||||||
public readonly IEcsWorld leftWorld;
|
public readonly IEcsWorld leftWorld;
|
||||||
public readonly IEcsWorld rightWorld;
|
public readonly IEcsWorld rightWorld;
|
||||||
@ -20,118 +20,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private int[] _leftMapping;
|
private int[] _leftMapping;
|
||||||
private int[] _rgihtMapping;
|
private int[] _rgihtMapping;
|
||||||
|
|
||||||
private int _relationsCount;
|
private EcsRelationWorld<TTableArhetype> _relationWorld;
|
||||||
|
|
||||||
private IEcsPool[] _pools;
|
|
||||||
private EcsNullPool _nullPool;
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public Type ArchetypeType => typeof(TWorldArchetype);
|
|
||||||
public int EntitesCount => _relationsCount;
|
|
||||||
public int EntitesCapacity => _relations.Length;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
internal EcsRelationTable(IEcsWorld leftWorld, IEcsWorld rightWorld)
|
|
||||||
{
|
|
||||||
this.leftWorld = leftWorld;
|
|
||||||
this.rightWorld = rightWorld;
|
|
||||||
|
|
||||||
_relations = new int[512];
|
|
||||||
_leftMapping = new int[512];
|
|
||||||
_rgihtMapping = new int[512];
|
|
||||||
|
|
||||||
_relationsCount = 0;
|
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region RealtionControls
|
|
||||||
public void AddRelation(int leftEnttiyID, int rightEntityID)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public void RemoveRelationLeft(int entityID)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public void RemoveRelationRight(int entityID)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public ReadOnlySpan<IEcsPool> GetAllPools()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetComponentID<T>()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EcsPool<T> GetPool<T>() where T : struct
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EcsPool<T> UncheckedGetPool<T>() where T : struct
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EcsFilter Query<TComponent>() where TComponent : struct
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EcsFilter Filter<TInc>() where TInc : struct, IInc
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EcsFilter Filter<TInc, TExc>()
|
|
||||||
where TInc : struct, IInc
|
|
||||||
where TExc : struct, IExc
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsMaskCompatible<TInc>(int entity) where TInc : struct, IInc
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsMaskCompatible<TInc, TExc>(int entity)
|
|
||||||
where TInc : struct, IInc
|
|
||||||
where TExc : struct, IExc
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsMaskCompatible(EcsMask mask, int entity)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsMaskCompatibleWithout(EcsMask mask, int entity, int otherPoolID)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IEcsReadonlyTable.OnEntityComponentAdded(int entityID, int changedPoolID)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IEcsReadonlyTable.OnEntityComponentRemoved(int entityID, int changedPoolID)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IEcsReadonlyTable.RegisterGroup(EcsGroup group)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Transactions;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -17,8 +18,6 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Entities
|
#region Entities
|
||||||
public TQuery Query<TQuery>(out TQuery entities) where TQuery : IEcsQuery;
|
|
||||||
|
|
||||||
public ent NewEntity();
|
public ent NewEntity();
|
||||||
public void DelEntity(ent entity);
|
public void DelEntity(ent entity);
|
||||||
public bool EntityIsAlive(int entityID, short gen);
|
public bool EntityIsAlive(int entityID, short gen);
|
||||||
@ -71,12 +70,33 @@ namespace DCFApixels.DragonECS
|
|||||||
private List<EcsQueryBase>[] _filtersByIncludedComponents;
|
private List<EcsQueryBase>[] _filtersByIncludedComponents;
|
||||||
private List<EcsQueryBase>[] _filtersByExcludedComponents;
|
private List<EcsQueryBase>[] _filtersByExcludedComponents;
|
||||||
|
|
||||||
private IEcsQuery[] _queries;
|
private EcsQueryBase[] _queries;
|
||||||
|
|
||||||
private EcsPipeline _pipeline;
|
private EcsPipeline _pipeline;
|
||||||
|
|
||||||
private List<EcsGroup> _groups;
|
private List<EcsGroup> _groups;
|
||||||
|
|
||||||
|
public IEcsRealationTable[] _relationTables;
|
||||||
|
|
||||||
|
#region RelationTables
|
||||||
|
public IEcsRealationTable GetRelationTalbe<TWorldArhetype>(TWorldArhetype targetWorld)
|
||||||
|
where TWorldArhetype : EcsWorld<TWorldArhetype>
|
||||||
|
{
|
||||||
|
int targetID = targetWorld.ID;
|
||||||
|
if (targetID <= 0)
|
||||||
|
throw new ArgumentException("targetWorld.ID <= 0");
|
||||||
|
|
||||||
|
if(_relationTables.Length <= targetID)
|
||||||
|
Array.Resize(ref _relationTables, targetID + 8);
|
||||||
|
|
||||||
|
if (_relationTables[targetID] == null)
|
||||||
|
{
|
||||||
|
// _relationTables[targetID]= new EcsRelationTable
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region RunnersCache
|
#region RunnersCache
|
||||||
private PoolRunnres _poolRunnres;
|
private PoolRunnres _poolRunnres;
|
||||||
@ -112,10 +132,10 @@ namespace DCFApixels.DragonECS
|
|||||||
_entityDispenser = new IntDispenser(0);
|
_entityDispenser = new IntDispenser(0);
|
||||||
_nullPool = EcsNullPool.instance;
|
_nullPool = EcsNullPool.instance;
|
||||||
_pools = new IEcsPool[512];
|
_pools = new IEcsPool[512];
|
||||||
FillArray(_pools, _nullPool);
|
ArrayUtility.Fill(_pools, _nullPool);
|
||||||
|
|
||||||
_gens = new short[512];
|
_gens = new short[512];
|
||||||
_queries = new EcsQuery<TWorldArchetype>[EntityArhetype.capacity];
|
_queries = new EcsQuery<TWorldArchetype>[QueryType.capacity];
|
||||||
_groups = new List<EcsGroup>(128);
|
_groups = new List<EcsGroup>(128);
|
||||||
|
|
||||||
_denseEntities = new int[512];
|
_denseEntities = new int[512];
|
||||||
@ -141,7 +161,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
int oldCapacity = _pools.Length;
|
int oldCapacity = _pools.Length;
|
||||||
Array.Resize(ref _pools, ComponentType.Capacity);
|
Array.Resize(ref _pools, ComponentType.Capacity);
|
||||||
FillArray(_pools, _nullPool, oldCapacity, oldCapacity - _pools.Length);
|
ArrayUtility.Fill(_pools, _nullPool, oldCapacity, oldCapacity - _pools.Length);
|
||||||
|
|
||||||
Array.Resize(ref _filtersByIncludedComponents, ComponentType.Capacity);
|
Array.Resize(ref _filtersByIncludedComponents, ComponentType.Capacity);
|
||||||
Array.Resize(ref _filtersByExcludedComponents, ComponentType.Capacity);
|
Array.Resize(ref _filtersByExcludedComponents, ComponentType.Capacity);
|
||||||
@ -156,18 +176,18 @@ namespace DCFApixels.DragonECS
|
|||||||
//public EcsPool<T> UncheckedGetPool<T>() where T : struct => (EcsPool<T>)_pools[ComponentType<T>.uniqueID];
|
//public EcsPool<T> UncheckedGetPool<T>() where T : struct => (EcsPool<T>)_pools[ComponentType<T>.uniqueID];
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Entities
|
#region Query
|
||||||
public TQuery Query<TQuery>(out TQuery entities) where TQuery : IEcsQuery
|
public TQuery Query<TQuery>(out TQuery query) where TQuery : EcsQueryBase
|
||||||
{
|
{
|
||||||
int uniqueID = EntityArhetype<TQuery>.uniqueID;
|
int uniqueID = QueryType<TQuery>.uniqueID;
|
||||||
if (_queries.Length < EntityArhetype.capacity)
|
if (_queries.Length < QueryType.capacity)
|
||||||
Array.Resize(ref _queries, EntityArhetype.capacity);
|
Array.Resize(ref _queries, QueryType.capacity);
|
||||||
|
|
||||||
if (_queries[uniqueID] == null)
|
if (_queries[uniqueID] == null)
|
||||||
{
|
{
|
||||||
_queries[uniqueID] = EcsQuery<TWorldArchetype>.Builder.Build<TQuery>(this);
|
_queries[uniqueID] = EcsQuery<TWorldArchetype>.Builder.Build<TQuery>(this);
|
||||||
var mask = _queries[uniqueID].Mask;
|
var mask = _queries[uniqueID].mask;
|
||||||
var filter = (EcsQueryBase)_queries[uniqueID];
|
var filter = _queries[uniqueID];
|
||||||
|
|
||||||
for (int i = 0; i < mask.Inc.Length; i++)
|
for (int i = 0; i < mask.Inc.Length; i++)
|
||||||
{
|
{
|
||||||
@ -200,8 +220,8 @@ namespace DCFApixels.DragonECS
|
|||||||
filter.AddEntity(entity);
|
filter.AddEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entities = (TQuery)_queries[uniqueID];
|
query = (TQuery)_queries[uniqueID];
|
||||||
return entities;
|
return query;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -217,20 +237,20 @@ namespace DCFApixels.DragonECS
|
|||||||
return IsMaskCompatible(EcsMaskMap<TWorldArchetype>.GetMask<TInc, TExc>(), entityID);
|
return IsMaskCompatible(EcsMaskMap<TWorldArchetype>.GetMask<TInc, TExc>(), entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsMaskCompatible(EcsComponentMask mask, int entity)
|
public bool IsMaskCompatible(EcsComponentMask mask, int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DRAGONECS_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DRAGONECS_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||||
if (mask.WorldArchetypeType != typeof(TWorldArchetype))
|
if (mask.WorldArchetypeType != typeof(TWorldArchetype))
|
||||||
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TWorldArchetype)");
|
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TTableArhetype)");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0, iMax = mask.Inc.Length; i < iMax; i++)
|
for (int i = 0, iMax = mask.Inc.Length; i < iMax; i++)
|
||||||
{
|
{
|
||||||
if (!_pools[mask.Inc[i]].Has(entity))
|
if (!_pools[mask.Inc[i]].Has(entityID))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0, iMax = mask.Exc.Length; i < iMax; i++)
|
for (int i = 0, iMax = mask.Exc.Length; i < iMax; i++)
|
||||||
{
|
{
|
||||||
if (_pools[mask.Exc[i]].Has(entity))
|
if (_pools[mask.Exc[i]].Has(entityID))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -240,7 +260,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DRAGONECS_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DRAGONECS_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||||
if (mask.WorldArchetypeType != typeof(TWorldArchetype))
|
if (mask.WorldArchetypeType != typeof(TWorldArchetype))
|
||||||
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TWorldArchetype)");
|
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TTableArhetype)");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0, iMax = mask.Inc.Length; i < iMax; i++)
|
for (int i = 0, iMax = mask.Inc.Length; i < iMax; i++)
|
||||||
{
|
{
|
||||||
@ -392,19 +412,19 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Utils
|
#region Utils
|
||||||
internal static class EntityArhetype
|
internal static class QueryType
|
||||||
{
|
{
|
||||||
public static int increment = 0;
|
public static int increment = 0;
|
||||||
public static int capacity = 128;
|
public static int capacity = 128;
|
||||||
}
|
}
|
||||||
internal static class EntityArhetype<TArhetype>
|
internal static class QueryType<TQuery>
|
||||||
{
|
{
|
||||||
public static int uniqueID;
|
public static int uniqueID;
|
||||||
static EntityArhetype()
|
static QueryType()
|
||||||
{
|
{
|
||||||
uniqueID = EntityArhetype.increment++;
|
uniqueID = QueryType.increment++;
|
||||||
if (EntityArhetype.increment > EntityArhetype.capacity)
|
if (QueryType.increment > QueryType.capacity)
|
||||||
EntityArhetype.capacity <<= 1;
|
QueryType.capacity <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal static class ComponentType
|
internal static class ComponentType
|
||||||
@ -436,22 +456,6 @@ namespace DCFApixels.DragonECS
|
|||||||
ComponentType.types[uniqueID] = typeof(T);
|
ComponentType.types[uniqueID] = typeof(T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FillArray<T>(T[] array, T value, int startIndex = 0, int length = -1)
|
|
||||||
{
|
|
||||||
if (length < 0)
|
|
||||||
{
|
|
||||||
length = array.Length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
length = startIndex + length;
|
|
||||||
}
|
|
||||||
for (int i = startIndex; i < length; i++)
|
|
||||||
{
|
|
||||||
array[i] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -7,26 +8,34 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Properties
|
#region Properties
|
||||||
/// <summary>Table Archetype</summary>
|
/// <summary>Table Archetype</summary>
|
||||||
public Type ArchetypeType { get; }
|
public Type ArchetypeType { get; }
|
||||||
internal int Count { get; }
|
public int Count { get; }
|
||||||
internal int Capacity { get; }
|
public int Capacity { get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
public ReadOnlySpan<IEcsPool> GetAllPools();
|
|
||||||
public int GetComponentID<T>();
|
|
||||||
|
|
||||||
public EcsPool<T> GetPool<T>() where T : struct;
|
public EcsPool<T> GetPool<T>() where T : struct;
|
||||||
|
public ReadOnlySpan<IEcsPool> GetAllPools();
|
||||||
|
public TQuery Query<TQuery>(out TQuery query) where TQuery : EcsQueryBase;
|
||||||
|
|
||||||
public bool IsMaskCompatible<TInc>(int entity) where TInc : struct, IInc;
|
public int GetComponentID<T>();
|
||||||
public bool IsMaskCompatible<TInc, TExc>(int entity) where TInc : struct, IInc where TExc : struct, IExc;
|
public bool IsMaskCompatible<TInc, TExc>(int entityID) where TInc : struct, IInc where TExc : struct, IExc;
|
||||||
public bool IsMaskCompatible(EcsComponentMask mask, int entity);
|
public bool IsMaskCompatible(EcsComponentMask mask, int entityID);
|
||||||
public bool IsMaskCompatibleWithout(EcsComponentMask mask, int entity, int otherPoolID);
|
public bool IsMaskCompatibleWithout(EcsComponentMask mask, int entity, int componentID);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Internal Methods
|
#region Internal Methods
|
||||||
internal void OnEntityComponentAdded(int entityID, int changedPoolID);
|
internal void OnEntityComponentAdded(int entityID, int componentID);
|
||||||
internal void OnEntityComponentRemoved(int entityID, int changedPoolID);
|
internal void OnEntityComponentRemoved(int entityID, int componentID);
|
||||||
internal void RegisterGroup(EcsGroup group);
|
internal void RegisterGroup(EcsGroup group);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class IEcsReadonlyTableExtensions
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsMaskCompatible<TInc>(this IEcsReadonlyTable self, int entityID) where TInc : struct, IInc
|
||||||
|
{
|
||||||
|
return self.IsMaskCompatible<TInc, Exc>(entityID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
21
src/Utils/ArrayUtility.cs
Normal file
21
src/Utils/ArrayUtility.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
namespace DCFApixels.DragonECS
|
||||||
|
{
|
||||||
|
internal static class ArrayUtility
|
||||||
|
{
|
||||||
|
public static void Fill<T>(T[] array, T value, int startIndex = 0, int length = -1)
|
||||||
|
{
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
length = array.Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = startIndex + length;
|
||||||
|
}
|
||||||
|
for (int i = startIndex; i < length; i++)
|
||||||
|
{
|
||||||
|
array[i] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user