Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
817B

  1. using System.Collections;
  2. #if ENGINE_PROFILER_ENABLED && UNITY_EDITOR
  3. using Svelto.ECS.Profiler;
  4. #endif
  5. namespace Svelto.ECS
  6. {
  7. public partial class EnginesRoot
  8. {
  9. class DoubleBufferedEntityViews<T> where T : class, IDictionary, new()
  10. {
  11. readonly T _entityViewsToAddBufferA = new T();
  12. readonly T _entityViewsToAddBufferB = new T();
  13. internal DoubleBufferedEntityViews()
  14. {
  15. this.other = _entityViewsToAddBufferA;
  16. this.current = _entityViewsToAddBufferB;
  17. }
  18. internal T other;
  19. internal T current;
  20. internal void Swap()
  21. {
  22. var toSwap = other;
  23. other = current;
  24. current = toSwap;
  25. }
  26. }
  27. }
  28. }