30 lines
834 B
C#
30 lines
834 B
C#
|
|
namespace OECS;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Describes a query over the ECS world.
|
||
|
|
/// Composed of a set of required component types ("with") and
|
||
|
|
/// a set of excluded component types ("without").
|
||
|
|
/// </summary>
|
||
|
|
public class QueryDescriptor
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Component types that must be present on matching entities.
|
||
|
|
/// </summary>
|
||
|
|
public IReadOnlySet<Type> With { get; }
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Component types that must NOT be present on matching entities.
|
||
|
|
/// </summary>
|
||
|
|
public IReadOnlySet<Type> Without { get; }
|
||
|
|
|
||
|
|
internal QueryDescriptor(HashSet<Type> with, HashSet<Type> without)
|
||
|
|
{
|
||
|
|
With = with;
|
||
|
|
Without = without;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Returns true if this query has no "with" components (matches nothing).
|
||
|
|
/// </summary>
|
||
|
|
internal bool IsEmpty => With.Count == 0;
|
||
|
|
}
|