using System; using System.Collections.Generic; namespace Svelto.ECS { /// /// Entities are always built in group. Where the group is not specificed, a special standard group is used /// ID can be reused within groups /// an EnginesRoot reference cannot be held by anything else than the Composition Root /// where it has been created. IEntityFactory and IEntityFunctions allow a weakreference /// of the EnginesRoot to be passed around. /// /// ExclusiveGroups must be used in your game like: /// static class GameExclusiveGroup ///{ /// public static readonly ExclusiveGroups PlayerEntitiesGroup = new ExclusiveGroups(); ///} /// /// public interface IEntityFactory { /// /// where performance is critical, you may wish to pre allocate the space needed /// to store the entities /// /// /// /// void PreallocateEntitySpace(ExclusiveGroupStruct groupStructId, uint numberOfEntities) where T : IEntityDescriptor, new(); /// /// The EntityDescriptor doesn't need to be ever instantiated. It just describes the Entity /// itself in terms of EntityComponents to build. The Implementors are passed to fill the /// references of the Entity View Components components if present. /// /// /// /// /// EntityInitializer BuildEntity(uint entityID, ExclusiveBuildGroup groupStructId, IEnumerable implementors = null) where T : IEntityDescriptor, new(); EntityInitializer BuildEntity(EGID egid, IEnumerable implementors = null) where T : IEntityDescriptor, new(); EntityInitializer BuildEntity(uint entityID, ExclusiveBuildGroup groupStructId, T descriptorEntity, IEnumerable implementors = null) where T : IEntityDescriptor; EntityInitializer BuildEntity(EGID egid, T entityDescriptor, IEnumerable implementors = null) where T : IEntityDescriptor; //Todo: analyze if this can be internal or just related to serialization EntityInitializer BuildEntity (EGID egid, IComponentBuilder[] componentsToBuild, Type descriptorType, IEnumerable implementors = null); #if UNITY_NATIVE Svelto.ECS.Native.NativeEntityFactory ToNative(string callerName) where T : IEntityDescriptor, new(); #endif } }