Entitas
0.35.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Entitas
Entitas
CodeGenerator
Generators
PoolAttributesGenerator.cs
1
using
System
.Linq;
2
3
namespace
Entitas
.CodeGenerator {
4
5
public
class
PoolAttributesGenerator
:
IPoolCodeGenerator
{
6
7
public
CodeGenFile
[] Generate(
string
[] poolNames) {
8
return
poolNames
9
.Where(poolName => !poolName.IsDefaultPoolName())
10
.Select(poolName => poolName.UppercaseFirst())
11
.Select(poolName =>
new
CodeGenFile
(
12
poolName +
"Attribute"
,
13
generatePoolAttributes(poolName),
14
GetType().FullName
15
)).ToArray();
16
}
17
18
static
string
generatePoolAttributes(
string
poolName) {
19
return
string
.Format(
@"using Entitas.CodeGenerator;
20
21
public class {0}Attribute : PoolAttribute {{
22
23
public {0}Attribute() : base(""{0}"") {{
24
}}
25
}}
26
27
"
, poolName);
28
}
29
}
30
}
Entitas
Definition:
EntitasCache.cs:3
System
Entitas.CodeGenerator.IPoolCodeGenerator
Definition:
IPoolCodeGenerator.cs:3
Entitas.CodeGenerator.PoolAttributesGenerator
Definition:
PoolAttributesGenerator.cs:5
Entitas.CodeGenerator.CodeGenFile
Definition:
CodeGenFile.cs:3
Generated by
1.8.12