move ITemplateNode from Unity

This commit is contained in:
Mikhail 2024-04-22 16:34:44 +08:00
parent 977ac5dbbd
commit 20d1e6d586

View 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;
}
}
}