mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-19 10:34:35 +08:00
26 lines
581 B
C#
26 lines
581 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.NewEntity();
|
|||
|
self.Apply(world, e);
|
|||
|
return e;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|