2024-03-03 03:51:49 +08:00
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
|
|
|
|
public interface ITemplate : ITemplateNode
|
|
|
|
|
{
|
|
|
|
|
//void Add(ITemplateNode template);
|
|
|
|
|
//void Remove(ITemplateNode template);
|
|
|
|
|
}
|
2024-04-22 16:34:31 +08:00
|
|
|
|
public static class ITemplateNodeExtensions
|
2024-03-03 03:51:49 +08:00
|
|
|
|
{
|
|
|
|
|
public static entlong NewEntityWithGameObject(this EcsWorld world, ITemplateNode template, string name = "Entity", GameObjectIcon icon = GameObjectIcon.NONE)
|
|
|
|
|
{
|
|
|
|
|
entlong e = world.NewEntityWithGameObject(name, icon);
|
|
|
|
|
template.Apply(world.id, e.ID);
|
|
|
|
|
return e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//[Serializable]
|
|
|
|
|
//public class EntityTemplateInheritanceMatrix
|
|
|
|
|
//{
|
|
|
|
|
// [SerializeReference]
|
|
|
|
|
// private ITemplateNode[] _components;
|
|
|
|
|
//
|
|
|
|
|
// #region Methods
|
|
|
|
|
// public void Apply(int worldID, int entityID)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (var item in _components)
|
|
|
|
|
// {
|
|
|
|
|
// item.Apply(worldID, entityID);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// #endregion
|
|
|
|
|
//}
|
|
|
|
|
}
|
2024-03-11 05:59:57 +08:00
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS.Unity.Internal
|
|
|
|
|
{
|
|
|
|
|
internal interface ITemplateInternal : ITemplate
|
|
|
|
|
{
|
|
|
|
|
string ComponentsPropertyName { get; }
|
|
|
|
|
//EntityTemplateInheritanceMatrix InheritanceMatrix { get; }
|
|
|
|
|
}
|
|
|
|
|
}
|