DragonECS/src/Interfaces/IEcsReadonlyTable.cs

39 lines
1.2 KiB
C#
Raw Normal View History

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-06 23:40:47 +08:00
public interface IEcsReadonlyTable
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-06 11:50:31 +08:00
#endregion
2023-04-06 23:40:47 +08:00
#region Methods
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-12 23:09:50 +08:00
public TQuery Query<TQuery>(out TQuery query) where TQuery : EcsQuery;
2023-04-06 11:50:31 +08:00
2023-04-08 00:47:35 +08:00
public int GetComponentID<T>();
public bool IsMaskCompatible<TInc, TExc>(int entityID) where TInc : struct, IInc where TExc : struct, IExc;
public bool IsMaskCompatible(EcsComponentMask mask, int entityID);
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);
#endregion
}
2023-04-08 00:47:35 +08:00
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);
}
}
2023-04-06 11:50:31 +08:00
}