@@ -41,7 +41,7 @@ namespace Svelto.ECS | |||
{ | |||
var dic = EntityFactory.BuildGroupedEntityViews(entityID, | |||
_groupedEntityToAdd.current, | |||
EntityDescriptorTemplate<T>.descriptor.EntityToBuild, | |||
EntityDescriptorTemplate<T>.descriptor.entitiesToBuild, | |||
implementors); | |||
return new EntityStructInitializer(entityID, dic); | |||
@@ -63,7 +63,7 @@ namespace Svelto.ECS | |||
void Preallocate<T>(int groupID, int size) where T : IEntityDescriptor, new() | |||
{ | |||
var entityViewsToBuild = EntityDescriptorTemplate<T>.descriptor.EntityToBuild; | |||
var entityViewsToBuild = EntityDescriptorTemplate<T>.descriptor.entitiesToBuild; | |||
var count = entityViewsToBuild.Length; | |||
//reserve space in the database | |||
@@ -5,17 +5,17 @@ namespace Svelto.ECS | |||
{ | |||
public interface IEntityDescriptor | |||
{ | |||
IEntityBuilder[] EntityToBuild { get; } | |||
IEntityBuilder[] entitiesToBuild { get; } | |||
} | |||
public class EntityDescriptor : IEntityDescriptor | |||
{ | |||
protected EntityDescriptor(IEntityBuilder[] entityToBuild) | |||
{ | |||
this.EntityToBuild = entityToBuild; | |||
this.entitiesToBuild = entityToBuild; | |||
} | |||
public IEntityBuilder[] EntityToBuild { get; } | |||
public IEntityBuilder[] entitiesToBuild { get; } | |||
} | |||
public static class EntityDescriptorTemplate<TType> where TType : IEntityDescriptor, new() | |||
@@ -30,25 +30,25 @@ namespace Svelto.ECS | |||
DBC.ECS.Check.Require(extraEntityViews.Count > 0, | |||
"don't use a DynamicEntityDescriptorInfo if you don't need to use extra EntityViews"); | |||
var defaultEntityViewsToBuild = EntityDescriptorTemplate<TType>.descriptor.EntityToBuild; | |||
var defaultEntityViewsToBuild = EntityDescriptorTemplate<TType>.descriptor.entitiesToBuild; | |||
var length = defaultEntityViewsToBuild.Length; | |||
EntityToBuild = new IEntityBuilder[length + extraEntityViews.Count]; | |||
entitiesToBuild = new IEntityBuilder[length + extraEntityViews.Count]; | |||
Array.Copy(defaultEntityViewsToBuild, 0, EntityToBuild, 0, length); | |||
Array.Copy(extraEntityViews.ToArrayFast(), 0, EntityToBuild, length, extraEntityViews.Count); | |||
Array.Copy(defaultEntityViewsToBuild, 0, entitiesToBuild, 0, length); | |||
Array.Copy(extraEntityViews.ToArrayFast(), 0, entitiesToBuild, length, extraEntityViews.Count); | |||
} | |||
public IEntityBuilder[] EntityToBuild { get; } | |||
public IEntityBuilder[] entitiesToBuild { get; } | |||
} | |||
public struct EntityDescriptor<TType>:IEntityDescriptor where TType : IEntityDescriptor | |||
{ | |||
internal EntityDescriptor(TType descriptor) | |||
{ | |||
EntityToBuild = descriptor.EntityToBuild; | |||
entitiesToBuild = descriptor.entitiesToBuild; | |||
} | |||
public IEntityBuilder[] EntityToBuild { get; } | |||
public IEntityBuilder[] entitiesToBuild { get; } | |||
} | |||
} |
@@ -112,7 +112,7 @@ namespace Svelto.ECS | |||
static readonly Type ENTITY_VIEW_TYPE = typeof(T); | |||
static readonly string DESCRIPTOR_NAME = ENTITY_VIEW_TYPE.ToString(); | |||
static readonly bool needsReflection = typeof(IEntityView).IsAssignableFrom(typeof(T)); | |||
static readonly bool needsReflection = typeof(IEntityViewStruct).IsAssignableFrom(typeof(T)); | |||
internal T _initializer; | |||
} | |||
@@ -7,7 +7,7 @@ | |||
EntityBuilders = new IEntityBuilder[] { new EntityBuilder<T>() }; | |||
} | |||
public IEntityBuilder[] EntityToBuild | |||
public IEntityBuilder[] entitiesToBuild | |||
{ | |||
get { return EntityBuilders; } | |||
} | |||
@@ -23,7 +23,7 @@ | |||
EntityBuilders = new IEntityBuilder[] {new EntityBuilder<T>(), new EntityBuilder<U>()}; | |||
} | |||
public IEntityBuilder[] EntityToBuild | |||
public IEntityBuilder[] entitiesToBuild | |||
{ | |||
get { return EntityBuilders; } | |||
} | |||
@@ -40,7 +40,7 @@ | |||
EntityBuilders = new IEntityBuilder[] {new EntityBuilder<T>(), new EntityBuilder<U>(), new EntityBuilder<V>()}; | |||
} | |||
public IEntityBuilder[] EntityToBuild | |||
public IEntityBuilder[] entitiesToBuild | |||
{ | |||
get { return EntityBuilders; } | |||
} | |||
@@ -58,7 +58,7 @@ | |||
EntityBuilders = new IEntityBuilder[] {new EntityBuilder<T>(), new EntityBuilder<U>(), new EntityBuilder<V>(), new EntityBuilder<W>()}; | |||
} | |||
public IEntityBuilder[] EntityToBuild | |||
public IEntityBuilder[] entitiesToBuild | |||
{ | |||
get { return EntityBuilders; } | |||
} | |||
@@ -77,7 +77,7 @@ | |||
EntityBuilders = new IEntityBuilder[] {new EntityBuilder<T>(), new EntityBuilder<U>(), new EntityBuilder<V>(), new EntityBuilder<W>(), new EntityBuilder<X>()}; | |||
} | |||
public IEntityBuilder[] EntityToBuild | |||
public IEntityBuilder[] entitiesToBuild | |||
{ | |||
get { return EntityBuilders; } | |||
} | |||
@@ -97,7 +97,7 @@ | |||
EntityBuilders = new IEntityBuilder[] {new EntityBuilder<T>(), new EntityBuilder<U>(), new EntityBuilder<V>(), new EntityBuilder<W>(), new EntityBuilder<X>(), new EntityBuilder<Y>()}; | |||
} | |||
public IEntityBuilder[] EntityToBuild | |||
public IEntityBuilder[] entitiesToBuild | |||
{ | |||
get { return EntityBuilders; } | |||
} | |||
@@ -13,10 +13,10 @@ namespace Svelto.ECS | |||
} | |||
///<summary>EntityViews and EntityViewStructs MUST implement IEntityView</summary> | |||
public interface IEntityView:IEntityStruct | |||
public interface IEntityViewStruct:IEntityStruct | |||
{} | |||
public class EntityView : IEntityView | |||
public class EntityView : IEntityViewStruct | |||
{ | |||
public EGID ID | |||
{ |