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.

240 lines
7.2KB

  1. namespace Svelto.ECS
  2. {
  3. public 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 readonly INodeBuilder[] _nodesToBuild;
  13. }
  14. public 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 readonly INodeBuilder[] _nodesToBuild;
  29. }
  30. public 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. static readonly INodeBuilder[] _nodesToBuild;
  47. }
  48. public class GenericEntityDescriptor<T, U, V, W> : EntityDescriptor
  49. where T : NodeWithID, new()
  50. where U : NodeWithID, new()
  51. where V : NodeWithID, new()
  52. where W : NodeWithID, new()
  53. {
  54. static GenericEntityDescriptor()
  55. {
  56. _nodesToBuild = new INodeBuilder[]
  57. {
  58. new NodeBuilder<T>(),
  59. new NodeBuilder<U>(),
  60. new NodeBuilder<V>(),
  61. new NodeBuilder<W>()
  62. };
  63. }
  64. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  65. {}
  66. static readonly INodeBuilder[] _nodesToBuild;
  67. }
  68. public class GenericEntityDescriptor<T, U, V, W, X> : EntityDescriptor
  69. where T : NodeWithID, new()
  70. where U : NodeWithID, new()
  71. where V : NodeWithID, new()
  72. where W : NodeWithID, new()
  73. where X : NodeWithID, new()
  74. {
  75. static GenericEntityDescriptor()
  76. {
  77. _nodesToBuild = new INodeBuilder[]
  78. {
  79. new NodeBuilder<T>(),
  80. new NodeBuilder<U>(),
  81. new NodeBuilder<V>(),
  82. new NodeBuilder<W>(),
  83. new NodeBuilder<X>()
  84. };
  85. }
  86. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  87. {}
  88. static readonly INodeBuilder[] _nodesToBuild;
  89. }
  90. public class GenericEntityDescriptor<T, U, V, W, X, Y> : EntityDescriptor
  91. where T : NodeWithID, new()
  92. where U : NodeWithID, new()
  93. where V : NodeWithID, new()
  94. where W : NodeWithID, new()
  95. where X : NodeWithID, new()
  96. where Y : NodeWithID, new()
  97. {
  98. static GenericEntityDescriptor()
  99. {
  100. _nodesToBuild = new INodeBuilder[]
  101. {
  102. new NodeBuilder<T>(),
  103. new NodeBuilder<U>(),
  104. new NodeBuilder<V>(),
  105. new NodeBuilder<W>(),
  106. new NodeBuilder<X>(),
  107. new NodeBuilder<Y>()
  108. };
  109. }
  110. public GenericEntityDescriptor(params object[] componentsImplementor) : base(_nodesToBuild, componentsImplementor)
  111. {}
  112. static readonly INodeBuilder[] _nodesToBuild;
  113. }
  114. public class GenericMixedEntityDescriptor<T> : EntityDescriptor
  115. where T : INodeBuilder, new()
  116. {
  117. static GenericMixedEntityDescriptor()
  118. {
  119. _nodesToBuild = new INodeBuilder[]
  120. {
  121. new T(),
  122. };
  123. }
  124. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  125. base(_nodesToBuild, componentsImplementor)
  126. { }
  127. static readonly INodeBuilder[] _nodesToBuild;
  128. }
  129. public class GenericMixedEntityDescriptor<T, U, V> : EntityDescriptor
  130. where T : INodeBuilder, new()
  131. where U : INodeBuilder, new()
  132. where V : INodeBuilder, new()
  133. {
  134. static GenericMixedEntityDescriptor()
  135. {
  136. _nodesToBuild = new INodeBuilder[]
  137. {
  138. new T(),
  139. new U(),
  140. new V()
  141. };
  142. }
  143. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  144. base(_nodesToBuild, componentsImplementor)
  145. { }
  146. static readonly INodeBuilder[] _nodesToBuild;
  147. }
  148. public class GenericMixedEntityDescriptor<T, U, V, W> : EntityDescriptor
  149. where T : INodeBuilder, new()
  150. where U : INodeBuilder, new()
  151. where V : INodeBuilder, new()
  152. where W : INodeBuilder, new()
  153. {
  154. static GenericMixedEntityDescriptor()
  155. {
  156. _nodesToBuild = new INodeBuilder[]
  157. {
  158. new T(),
  159. new U(),
  160. new V(),
  161. new W()
  162. };
  163. }
  164. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  165. base(_nodesToBuild, componentsImplementor)
  166. { }
  167. static readonly INodeBuilder[] _nodesToBuild;
  168. }
  169. public class GenericMixedEntityDescriptor<T, U, V, W, X> : EntityDescriptor
  170. where T : INodeBuilder, new()
  171. where U : INodeBuilder, new()
  172. where V : INodeBuilder, new()
  173. where W : INodeBuilder, new()
  174. where X : INodeBuilder, new()
  175. {
  176. static GenericMixedEntityDescriptor()
  177. {
  178. _nodesToBuild = new INodeBuilder[]
  179. {
  180. new T(),
  181. new U(),
  182. new V(),
  183. new W(),
  184. new X()
  185. };
  186. }
  187. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  188. base(_nodesToBuild, componentsImplementor)
  189. { }
  190. static readonly INodeBuilder[] _nodesToBuild;
  191. }
  192. public class GenericMixedEntityDescriptor<T, U, V, W, X, Y> : EntityDescriptor
  193. where T : INodeBuilder, new()
  194. where U : INodeBuilder, new()
  195. where V : INodeBuilder, new()
  196. where W : INodeBuilder, new()
  197. where X : INodeBuilder, new()
  198. where Y : INodeBuilder, new()
  199. {
  200. static GenericMixedEntityDescriptor()
  201. {
  202. _nodesToBuild = new INodeBuilder[]
  203. {
  204. new T(),
  205. new U(),
  206. new V(),
  207. new W(),
  208. new X(),
  209. new Y()
  210. };
  211. }
  212. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  213. base(_nodesToBuild, componentsImplementor)
  214. { }
  215. static readonly INodeBuilder[] _nodesToBuild;
  216. }
  217. }