예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityManager" /> class.
        /// </summary>
        /// <param name="entityWorld">The entity world.</param>
        public EntityManager(EntityWorld entityWorld)
        {
            Debug.Assert(entityWorld != null, "EntityWorld must not be null.");

            this.uniqueIdToEntities       = new Dictionary <int, Entity>();
            this.removedAndAvailable      = new Bag <Entity>();
            this.componentsByType         = new Bag <Bag <IEntityComponent> >();
            this.ActiveEntities           = new Bag <Entity>();
            this.identifierPool           = new Bag <int>(4);
            this.RemovedEntitiesRetention = 100;
            this.entityWorld       = entityWorld;
            RemovedComponentEvent += EntityManagerRemovedComponentEvent;
        }