From 20d1e6d586ef105d26637bb5b77db2ce4be97a68 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:34:44 +0800 Subject: [PATCH] move ITemplateNode from Unity --- src/Utils/ITemplateNode.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Utils/ITemplateNode.cs diff --git a/src/Utils/ITemplateNode.cs b/src/Utils/ITemplateNode.cs new file mode 100644 index 0000000..3f4d985 --- /dev/null +++ b/src/Utils/ITemplateNode.cs @@ -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; + } + } +} \ No newline at end of file