DragonECS-Unity/src/EntityTemplate/ITemplate.cs

26 lines
581 B
C#
Raw Normal View History

2023-05-07 00:50:44 +08:00
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.NewEntity();
self.Apply(world, e);
return e;
}
}
}