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.

53 lines
1.5KB

  1. using System;
  2. using System.Diagnostics;
  3. namespace Svelto.ECS
  4. {
  5. #pragma warning disable 660,661
  6. struct EntitySubmitOperation
  7. #pragma warning restore 660,661
  8. : IEquatable<EntitySubmitOperation>
  9. {
  10. public readonly EntitySubmitOperationType type;
  11. public readonly IEntityBuilder[] builders;
  12. public readonly EGID fromID;
  13. public readonly EGID toID;
  14. #if DEBUG && !PROFILER
  15. public StackFrame trace;
  16. #endif
  17. public EntitySubmitOperation(EntitySubmitOperationType operation, EGID from, EGID to,
  18. IEntityBuilder[] builders = null)
  19. {
  20. type = operation;
  21. this.builders = builders;
  22. fromID = from;
  23. toID = to;
  24. #if DEBUG && !PROFILER
  25. trace = default;
  26. #endif
  27. }
  28. public static bool operator ==(EntitySubmitOperation obj1, EntitySubmitOperation obj2)
  29. {
  30. return obj1.Equals(obj2);
  31. }
  32. public static bool operator !=(EntitySubmitOperation obj1, EntitySubmitOperation obj2)
  33. {
  34. return obj1.Equals(obj2) == false;
  35. }
  36. public bool Equals(EntitySubmitOperation other)
  37. {
  38. return type == other.type && fromID == other.fromID && toID == other.toID;
  39. }
  40. }
  41. enum EntitySubmitOperationType
  42. {
  43. Swap,
  44. Remove,
  45. RemoveGroup
  46. }
  47. }