Exemple #1
0
        public IEcsEntity CreateEntity <TC0>(TC0 component0) where TC0 : class, IEcsComponent, new()
        {
            EcsEntityExtended entity = _entitiesPool.Count <= 0
                ? new EcsEntityExtended(_entitiesPool, _entities, _archetypeManager)
                : _entitiesPool.Dequeue();
            uint id = _entityCounter++;

            entity.Initialize(id, component0);
            _entities.Add(id, entity);
            return(entity);
        }
Exemple #2
0
        public IEcsEntity CreateEntity()
        {
            EcsEntityExtended entity = _entitiesPool.Count <= 0
                ? new EcsEntityExtended(_entitiesPool, _entities, _archetypeManager)
                : _entitiesPool.Dequeue();
            uint id = _entityCounter++;

            entity.Initialize(id);
            _entities.Add(id, entity);
            return(entity);
        }
        private EcsEntityExtended CreateEntity(uint id)
        {
            EcsEntityExtended entity = _entitiesPool.Count <= 0
                ? new EcsEntityExtended(_entitiesPool, _entities, _archetypeManager)
                : _entitiesPool.Dequeue();

            entity.Initialize(id);

            _entities.Add(id, entity);
            _entityCounter = Math.Max(_entityCounter, ++id);

            return(entity);
        }