DragonECS-Unity/src/EntityTemplate/ITemplate.cs
2023-05-23 01:48:54 +08:00

26 lines
586 B
C#

using UnityEngine;
namespace DCFApixels.DragonECS
{
public interface ITemplate
{
public void Apply(EcsWorld world, int entityID);
}
public interface ITemplateInternal : ITemplate
{
// internal ITemplateBrowsable[] Components { get; set; }
internal string ComponentsPropertyName { get; }
}
public static class ITemplateExt
{
public static int NewEntity(this ITemplate self, EcsWorld world)
{
int e = world.NewEmptyEntity();
self.Apply(world, e);
return e;
}
}
}