2023-04-06 11:50:31 +08:00
|
|
|
|
using System;
|
2023-04-08 00:47:35 +08:00
|
|
|
|
using System.Runtime.CompilerServices;
|
2023-04-06 11:50:31 +08:00
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
2023-04-18 19:35:42 +08:00
|
|
|
|
public interface IEcsTable
|
2023-04-06 11:50:31 +08:00
|
|
|
|
{
|
|
|
|
|
#region Properties
|
2023-04-06 23:40:47 +08:00
|
|
|
|
/// <summary>Table Archetype</summary>
|
2023-04-06 11:50:31 +08:00
|
|
|
|
public Type ArchetypeType { get; }
|
2023-04-08 00:47:35 +08:00
|
|
|
|
public int Count { get; }
|
|
|
|
|
public int Capacity { get; }
|
2023-04-20 10:59:55 +08:00
|
|
|
|
public EcsReadonlyGroup Entities => default;
|
2023-04-06 11:50:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
2023-04-06 23:40:47 +08:00
|
|
|
|
#region Methods
|
2023-04-20 10:59:55 +08:00
|
|
|
|
public int GetComponentID<T>();
|
2023-04-06 11:50:31 +08:00
|
|
|
|
public EcsPool<T> GetPool<T>() where T : struct;
|
2023-04-09 02:52:39 +08:00
|
|
|
|
public ReadOnlySpan<EcsPool> GetAllPools();
|
2023-04-20 10:59:55 +08:00
|
|
|
|
public TQuery Where<TQuery>(out TQuery query) where TQuery : EcsQueryBase;
|
|
|
|
|
public TQuery Select<TQuery>() where TQuery : EcsQueryBase;
|
2023-04-06 11:50:31 +08:00
|
|
|
|
|
2023-04-08 00:47:35 +08:00
|
|
|
|
public bool IsMaskCompatible<TInc, TExc>(int entityID) where TInc : struct, IInc where TExc : struct, IExc;
|
|
|
|
|
public bool IsMaskCompatible(EcsComponentMask mask, int entityID);
|
2023-04-20 10:59:55 +08:00
|
|
|
|
|
|
|
|
|
public void Destroy();
|
2023-04-06 23:40:47 +08:00
|
|
|
|
#endregion
|
2023-04-06 11:50:31 +08:00
|
|
|
|
|
2023-04-06 23:40:47 +08:00
|
|
|
|
#region Internal Methods
|
2023-04-06 11:50:31 +08:00
|
|
|
|
internal void RegisterGroup(EcsGroup group);
|
2023-04-20 10:59:55 +08:00
|
|
|
|
internal EcsGroup GetGroupFromPool();
|
|
|
|
|
internal void ReleaseGroup(EcsGroup group);
|
2023-04-06 11:50:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
2023-04-08 00:47:35 +08:00
|
|
|
|
|
|
|
|
|
public static class IEcsReadonlyTableExtensions
|
|
|
|
|
{
|
2023-04-18 19:35:42 +08:00
|
|
|
|
public static bool IsMaskCompatible<TInc>(this IEcsTable self, int entityID) where TInc : struct, IInc
|
2023-04-08 00:47:35 +08:00
|
|
|
|
{
|
|
|
|
|
return self.IsMaskCompatible<TInc, Exc>(entityID);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-06 11:50:31 +08:00
|
|
|
|
}
|