Пример #1
0
        public EcsQuery Without <T> () where T : struct
        {
            var typeId = EcsComponentType <T> .GetIdInWorld(_world.Index);

#if DEBUG
            if (typeId <= 0)
            {
                throw new Exception($"invalid query: \"{typeof (T).Name}\" component not registered in world.");
            }
            if (_include.Get(typeId) || _exclude.Get(typeId))
            {
                throw new Exception($"Invalid query: \"{typeof (T).Name}\" constraint already used.");
            }
#endif
            _exclude.Set(typeId);
            return(this);
        }
Пример #2
0
        public EcsQuery With <T> () where T : struct
        {
            var typeId = EcsComponentType <T> .GetIdInWorld(_world.Index);

#if DEBUG
            if (typeId <= 0)
            {
                throw new Exception($"invalid query: \"{typeof (T).Name}\" component not registered in world.");
            }
            if (_include.Get(typeId) || _exclude.Get(typeId))
            {
                throw new Exception($"invalid query: \"{typeof (T).Name}\" constraint already used.");
            }
#endif
            _include.Set(typeId);
            var pool      = _world.Pools[typeId];
            var poolCount = pool.Entities.GetCount();
            if (poolCount < _entitiesCount)
            {
                _entities      = pool.Entities;
                _entitiesCount = poolCount;
            }
            return(this);
        }
Пример #3
0
 public override void UnregisterWorld(int worldId)
 {
     EcsComponentType <T> .Unregister(worldId);
 }