namespace OECS;
///
/// Fluent builder for constructing instances.
/// Returned by .
///
public class QueryBuilder
{
private readonly HashSet _with = new();
private readonly HashSet _without = new();
///
/// Requires entities to have a component of type .
///
public QueryBuilder With() where T : struct
{
_with.Add(typeof(T));
return this;
}
///
/// Excludes entities that have a component of type .
///
public QueryBuilder Without() where T : struct
{
_without.Add(typeof(T));
return this;
}
///
/// Builds the query descriptor.
///
public QueryDescriptor Build()
{
return new QueryDescriptor(
new HashSet(_with),
new HashSet(_without));
}
}