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.

259 lines
7.8KB

  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> : EntityDescriptor
  130. where T : INodeBuilder, new()
  131. where U : INodeBuilder, new()
  132. {
  133. static GenericMixedEntityDescriptor()
  134. {
  135. _nodesToBuild = new INodeBuilder[]
  136. {
  137. new T(),
  138. new U(),
  139. };
  140. }
  141. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  142. base(_nodesToBuild, componentsImplementor)
  143. { }
  144. static readonly INodeBuilder[] _nodesToBuild;
  145. }
  146. public class GenericMixedEntityDescriptor<T, U, V> : EntityDescriptor
  147. where T : INodeBuilder, new()
  148. where U : INodeBuilder, new()
  149. where V : INodeBuilder, new()
  150. {
  151. static GenericMixedEntityDescriptor()
  152. {
  153. _nodesToBuild = new INodeBuilder[]
  154. {
  155. new T(),
  156. new U(),
  157. new V()
  158. };
  159. }
  160. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  161. base(_nodesToBuild, componentsImplementor)
  162. { }
  163. static readonly INodeBuilder[] _nodesToBuild;
  164. }
  165. public class GenericMixedEntityDescriptor<T, U, V, W> : EntityDescriptor
  166. where T : INodeBuilder, new()
  167. where U : INodeBuilder, new()
  168. where V : INodeBuilder, new()
  169. where W : INodeBuilder, new()
  170. {
  171. static GenericMixedEntityDescriptor()
  172. {
  173. _nodesToBuild = new INodeBuilder[]
  174. {
  175. new T(),
  176. new U(),
  177. new V(),
  178. new W()
  179. };
  180. }
  181. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  182. base(_nodesToBuild, componentsImplementor)
  183. { }
  184. static readonly INodeBuilder[] _nodesToBuild;
  185. }
  186. public class GenericMixedEntityDescriptor<T, U, V, W, X> : EntityDescriptor
  187. where T : INodeBuilder, new()
  188. where U : INodeBuilder, new()
  189. where V : INodeBuilder, new()
  190. where W : INodeBuilder, new()
  191. where X : INodeBuilder, new()
  192. {
  193. static GenericMixedEntityDescriptor()
  194. {
  195. _nodesToBuild = new INodeBuilder[]
  196. {
  197. new T(),
  198. new U(),
  199. new V(),
  200. new W(),
  201. new X()
  202. };
  203. }
  204. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  205. base(_nodesToBuild, componentsImplementor)
  206. { }
  207. static readonly INodeBuilder[] _nodesToBuild;
  208. }
  209. public class GenericMixedEntityDescriptor<T, U, V, W, X, Y> : EntityDescriptor
  210. where T : INodeBuilder, new()
  211. where U : INodeBuilder, new()
  212. where V : INodeBuilder, new()
  213. where W : INodeBuilder, new()
  214. where X : INodeBuilder, new()
  215. where Y : INodeBuilder, new()
  216. {
  217. static GenericMixedEntityDescriptor()
  218. {
  219. _nodesToBuild = new INodeBuilder[]
  220. {
  221. new T(),
  222. new U(),
  223. new V(),
  224. new W(),
  225. new X(),
  226. new Y()
  227. };
  228. }
  229. public GenericMixedEntityDescriptor(params object[] componentsImplementor) :
  230. base(_nodesToBuild, componentsImplementor)
  231. { }
  232. static readonly INodeBuilder[] _nodesToBuild;
  233. }
  234. }