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.

EntitySubmitOperation.cs 1.7KB

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