forked from Misaki/GhostEngine
54 lines
1.5 KiB
Plaintext
54 lines
1.5 KiB
Plaintext
<#@ template language="C#" #>
|
|
<#@ output extension=".cs" #>
|
|
<#@ assembly name="System.Core" #>
|
|
<#@ import namespace="System.Linq" #>
|
|
<#@ import namespace="System.Text" #>
|
|
<#@ include file="Helpers.ttinclude" #>
|
|
|
|
using Ghost.Entities.Components;
|
|
using Ghost.Entities.Query;
|
|
|
|
namespace Ghost.Entities;
|
|
|
|
public partial class World
|
|
{
|
|
<# for (var index = 1; index <= Amount; index++) {
|
|
var generics = AppendGenerics(index);
|
|
var restrictions = AppendGenericRestrictions(index, "unmanaged, IComponentData");
|
|
var tryGetPools = TryGetComponentPools(index);
|
|
var poolParams = Enumerable.Range(0, index)
|
|
.Select(i => $"pool{i}")
|
|
.Aggregate((a,b)=> a + ", " + b);
|
|
var countSource = "pool0.Count";
|
|
#>
|
|
public QueryEnumerable<<#= generics #>> Query<<#= generics #>>()
|
|
<#= restrictions #>
|
|
{
|
|
if (!(<#= tryGetPools #>))
|
|
{
|
|
return default;
|
|
}
|
|
|
|
return new QueryEnumerable<<#= generics #>>(
|
|
this,
|
|
<#= poolParams #>,
|
|
<#= countSource #>);
|
|
}
|
|
|
|
public QueryEnumerable<<#= generics #>> QueryFilter<<#= generics #>>(ref readonly QueryFilter filter)
|
|
<#= restrictions #>
|
|
{
|
|
if (!(<#= tryGetPools #>))
|
|
{
|
|
return default;
|
|
}
|
|
|
|
return new QueryEnumerable<<#= generics #>>(
|
|
this,
|
|
<#= poolParams #>,
|
|
<#= countSource #>,
|
|
in filter);
|
|
}
|
|
|
|
<# } #>
|
|
} |