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.9KB

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