Mirror of Svelto.ECS because we're a fan of it
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

51 satır
1.3KB

  1. namespace Svelto.ECS
  2. {
  3. public ref struct EntityFilterIterator
  4. {
  5. internal EntityFilterIterator(EntityFilterCollection filter)
  6. {
  7. _filter = filter;
  8. _indexGroup = -1;
  9. _current = default;
  10. }
  11. public bool MoveNext()
  12. {
  13. while (++_indexGroup < _filter.groupCount)
  14. {
  15. _current = _filter.GetGroup(_indexGroup);
  16. if (_current.count > 0) break;
  17. }
  18. return _indexGroup < _filter.groupCount;
  19. }
  20. public void Reset()
  21. {
  22. _indexGroup = -1;
  23. }
  24. public RefCurrent Current => new RefCurrent(_current);
  25. int _indexGroup;
  26. readonly EntityFilterCollection _filter;
  27. EntityFilterCollection.GroupFilters _current;
  28. public readonly ref struct RefCurrent
  29. {
  30. internal RefCurrent(EntityFilterCollection.GroupFilters filter)
  31. {
  32. _filter = filter;
  33. }
  34. public void Deconstruct(out EntityFilterIndices indices, out ExclusiveGroupStruct group)
  35. {
  36. indices = _filter.indices;
  37. group = _filter.group;
  38. }
  39. readonly EntityFilterCollection.GroupFilters _filter;
  40. }
  41. }
  42. }