mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 18:14:35 +08:00
move ITemplateNode to Coore
This commit is contained in:
parent
93f93a3ddb
commit
1a798dffbe
@ -1,28 +1,12 @@
|
|||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public interface ITemplateNode
|
|
||||||
{
|
|
||||||
void Apply(int worldID, int entityID);
|
|
||||||
}
|
|
||||||
public interface ITemplate : ITemplateNode
|
public interface ITemplate : ITemplateNode
|
||||||
{
|
{
|
||||||
//void Add(ITemplateNode template);
|
//void Add(ITemplateNode template);
|
||||||
//void Remove(ITemplateNode template);
|
//void Remove(ITemplateNode template);
|
||||||
}
|
}
|
||||||
public static class ITemplateExtensions
|
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;
|
|
||||||
}
|
|
||||||
public static entlong NewEntityWithGameObject(this EcsWorld world, ITemplateNode template, string name = "Entity", GameObjectIcon icon = GameObjectIcon.NONE)
|
public static entlong NewEntityWithGameObject(this EcsWorld world, ITemplateNode template, string name = "Entity", GameObjectIcon icon = GameObjectIcon.NONE)
|
||||||
{
|
{
|
||||||
entlong e = world.NewEntityWithGameObject(name, icon);
|
entlong e = world.NewEntityWithGameObject(name, icon);
|
||||||
|
Loading…
Reference in New Issue
Block a user