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.

GenericEntityDescriptor.cs 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. namespace Svelto.ECS
  2. {
  3. class GenericEntityDescriptor<T> : EntityDescriptor
  4. where T : NodeWithID, new()
  5. {
  6. static GenericEntityDescriptor()
  7. {
  8. _nodesToBuild = new INodeBuilder[] { new NodeBuilder<T>() };
  9. }
  10. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  11. {}
  12. static INodeBuilder[] _nodesToBuild;
  13. }
  14. class GenericEntityDescriptor<T, U> : EntityDescriptor
  15. where T : NodeWithID, new()
  16. where U : NodeWithID, new()
  17. {
  18. static GenericEntityDescriptor()
  19. {
  20. _nodesToBuild = new INodeBuilder[]
  21. {
  22. new NodeBuilder<T>(),
  23. new NodeBuilder<U>()
  24. };
  25. }
  26. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  27. {}
  28. static INodeBuilder[] _nodesToBuild;
  29. }
  30. class GenericEntityDescriptor<T, U, V> : EntityDescriptor
  31. where T : NodeWithID, new()
  32. where U : NodeWithID, new()
  33. where V : NodeWithID, new()
  34. {
  35. static GenericEntityDescriptor()
  36. {
  37. _nodesToBuild = new INodeBuilder[]
  38. {
  39. new NodeBuilder<T>(),
  40. new NodeBuilder<U>(),
  41. new NodeBuilder<V>()
  42. };
  43. }
  44. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  45. {
  46. }
  47. static INodeBuilder[] _nodesToBuild;
  48. }
  49. class GenericEntityDescriptor<T, U, V, W> : EntityDescriptor
  50. where T : NodeWithID, new()
  51. where U : NodeWithID, new()
  52. where V : NodeWithID, new()
  53. where W : NodeWithID, new()
  54. {
  55. static GenericEntityDescriptor()
  56. {
  57. _nodesToBuild = new INodeBuilder[]
  58. {
  59. new NodeBuilder<T>(),
  60. new NodeBuilder<U>(),
  61. new NodeBuilder<V>(),
  62. new NodeBuilder<W>()
  63. };
  64. }
  65. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  66. {
  67. }
  68. static INodeBuilder[] _nodesToBuild;
  69. }
  70. class GenericEntityDescriptor<T, U, V, W, X> : EntityDescriptor
  71. where T : NodeWithID, new()
  72. where U : NodeWithID, new()
  73. where V : NodeWithID, new()
  74. where W : NodeWithID, new()
  75. where X : NodeWithID, new()
  76. {
  77. static GenericEntityDescriptor()
  78. {
  79. _nodesToBuild = new INodeBuilder[]
  80. {
  81. new NodeBuilder<T>(),
  82. new NodeBuilder<U>(),
  83. new NodeBuilder<V>(),
  84. new NodeBuilder<W>(),
  85. new NodeBuilder<X>()
  86. };
  87. }
  88. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  89. {
  90. }
  91. static INodeBuilder[] _nodesToBuild;
  92. }
  93. class GenericEntityDescriptor<T, U, V, W, X, Y> : EntityDescriptor
  94. where T : NodeWithID, new()
  95. where U : NodeWithID, new()
  96. where V : NodeWithID, new()
  97. where W : NodeWithID, new()
  98. where X : NodeWithID, new()
  99. where Y : NodeWithID, new()
  100. {
  101. static GenericEntityDescriptor()
  102. {
  103. _nodesToBuild = new INodeBuilder[]
  104. {
  105. new NodeBuilder<T>(),
  106. new NodeBuilder<U>(),
  107. new NodeBuilder<V>(),
  108. new NodeBuilder<W>(),
  109. new NodeBuilder<X>(),
  110. new NodeBuilder<Y>()
  111. };
  112. }
  113. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  114. {
  115. }
  116. static INodeBuilder[] _nodesToBuild;
  117. }
  118. }