mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 17:34:36 +08:00
move ITemplateNode from Unity
This commit is contained in:
parent
977ac5dbbd
commit
20d1e6d586
22
src/Utils/ITemplateNode.cs
Normal file
22
src/Utils/ITemplateNode.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface ITemplateNode
|
||||
{
|
||||
void Apply(int worldID, int entityID);
|
||||
}
|
||||
public static class ITemplateNodeExtensions
|
||||
{
|
||||
public static int NewEntity(this EcsWorld world, ITemplateNode template)
|
||||
{
|
||||
int e = world.NewEntity();
|
||||
template.Apply(world.id, e);
|
||||
return e;
|
||||
}
|
||||
public static entlong NewEntityLong(this EcsWorld world, ITemplateNode template)
|
||||
{
|
||||
entlong e = world.NewEntityLong();
|
||||
template.Apply(world.id, e.ID);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user