Exemplo n.º 1
0
            public bool MoveNext()
            {
                //attention, the while is necessary to skip empty groups
                while (++_indexGroup < _groups.count)
                {
                    var entityCollection1 = _entitiesDB.QueryEntities <T1, T2, T3>(_groups[_indexGroup]);
                    if (entityCollection1.count == 0)
                    {
                        continue;
                    }
                    var entityCollection2 = _entitiesDB.QueryEntities <T4>(_groups[_indexGroup]);
                    if (entityCollection2.count == 0)
                    {
                        continue;
                    }

                    Check.Assert(entityCollection1.count == entityCollection2.count
                                 , "congratulation, you found a bug in Svelto, please report it");

                    BT <IBuffer <T1>, IBuffer <T2>, IBuffer <T3> > array = entityCollection1.ToBuffers();
                    IBuffer <T4> array2 = entityCollection2.ToBuffer();
                    _buffers = new BT <IBuffer <T1>, IBuffer <T2>, IBuffer <T3>, IBuffer <T4> >(
                        array.buffer1, array.buffer2, array.buffer3, array2, entityCollection1.count);
                    break;
                }

                return(_indexGroup < _groups.count);
            }
            public bool MoveNext()
            {
                //attention, the while is necessary to skip empty groups
                while (_db.MoveNext() == true)
                {
                    FasterDictionary<uint, ITypeSafeDictionary>.KeyValuePairFast group = _db.Current;

                    ITypeSafeDictionary<T1> typeSafeDictionary1 = @group.Value as ITypeSafeDictionary<T1>;
                    ITypeSafeDictionary<T2> typeSafeDictionary2 = @group.Value as ITypeSafeDictionary<T2>;

                    DBC.ECS.Check.Require(typeSafeDictionary1.Count != typeSafeDictionary2.Count
                                        , "entities count do not match"); 
                        
                    if (typeSafeDictionary1.Count == 0) continue;
                    
                    _array = new BT<NB<T1>, NB<T2>>()(new EntityCollection<T1>(typeSafeDictionary1.GetValuesArray(out var count), count)
                       .ToBuffer();

                    return true;
                }

                return false;
            }