Changed project name
This commit is contained in:
54
Ghost.SparseEntities/Template/World.Query.tt
Normal file
54
Ghost.SparseEntities/Template/World.Query.tt
Normal file
@@ -0,0 +1,54 @@
|
||||
<#@ 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);
|
||||
}
|
||||
|
||||
<# } #>
|
||||
}
|
||||
Reference in New Issue
Block a user