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.

108 lines
4.6KB

  1. namespace Svelto.ECS
  2. {
  3. public class MixedEntityDescriptor<T>:IEntityDescriptor where T : class, IEntityViewBuilder, new()
  4. {
  5. static MixedEntityDescriptor()
  6. {
  7. _entityViewsToBuild = new IEntityViewBuilder[] {new T()};
  8. }
  9. public IEntityViewBuilder[] entityViewsToBuild
  10. {
  11. get { return _entityViewsToBuild; }
  12. }
  13. static readonly IEntityViewBuilder[] _entityViewsToBuild;
  14. }
  15. public class MixedEntityDescriptor<T, U> : IEntityDescriptor where T : class, IEntityViewBuilder, new()
  16. where U : class, IEntityViewBuilder, new()
  17. {
  18. static MixedEntityDescriptor()
  19. {
  20. _entityViewsToBuild = new IEntityViewBuilder[] {new T(), new U()};
  21. }
  22. public IEntityViewBuilder[] entityViewsToBuild
  23. {
  24. get { return _entityViewsToBuild; }
  25. }
  26. static readonly IEntityViewBuilder[] _entityViewsToBuild;
  27. }
  28. public class MixedEntityDescriptor<T, U, V> : IEntityDescriptor where T : class, IEntityViewBuilder, new()
  29. where U : class, IEntityViewBuilder, new()
  30. where V : class, IEntityViewBuilder, new()
  31. {
  32. static MixedEntityDescriptor()
  33. {
  34. _entityViewsToBuild = new IEntityViewBuilder[] {new T(), new U(), new V()};
  35. }
  36. public IEntityViewBuilder[] entityViewsToBuild
  37. {
  38. get { return _entityViewsToBuild; }
  39. }
  40. static readonly IEntityViewBuilder[] _entityViewsToBuild;
  41. }
  42. public class MixedEntityDescriptor<T, U, V, W> : IEntityDescriptor where T : class, IEntityViewBuilder, new()
  43. where U : class, IEntityViewBuilder, new()
  44. where V : class, IEntityViewBuilder, new()
  45. where W : class, IEntityViewBuilder, new()
  46. {
  47. static MixedEntityDescriptor()
  48. {
  49. _entityViewsToBuild = new IEntityViewBuilder[] {new T(), new U(), new V(), new W()};
  50. }
  51. public IEntityViewBuilder[] entityViewsToBuild
  52. {
  53. get { return _entityViewsToBuild; }
  54. }
  55. static readonly IEntityViewBuilder[] _entityViewsToBuild;
  56. }
  57. public class MixedEntityDescriptor<T, U, V, W, X> : IEntityDescriptor where T : class, IEntityViewBuilder, new()
  58. where U : class, IEntityViewBuilder, new()
  59. where V : class, IEntityViewBuilder, new()
  60. where W : class, IEntityViewBuilder, new()
  61. where X : class, IEntityViewBuilder, new()
  62. {
  63. static MixedEntityDescriptor()
  64. {
  65. _entityViewsToBuild = new IEntityViewBuilder[] {new T(), new U(), new V(), new W(), new X()};
  66. }
  67. public IEntityViewBuilder[] entityViewsToBuild
  68. {
  69. get { return _entityViewsToBuild; }
  70. }
  71. static readonly IEntityViewBuilder[] _entityViewsToBuild;
  72. }
  73. public class MixedEntityDescriptor<T, U, V, W, X, Y> : IEntityDescriptor where T : class, IEntityViewBuilder, new()
  74. where U : class, IEntityViewBuilder, new()
  75. where V : class, IEntityViewBuilder, new()
  76. where W : class, IEntityViewBuilder, new()
  77. where X : class, IEntityViewBuilder, new()
  78. where Y : class, IEntityViewBuilder, new()
  79. {
  80. static MixedEntityDescriptor()
  81. {
  82. _entityViewsToBuild = new IEntityViewBuilder[] {new T(), new U(), new V(), new W(), new X(), new Y()};
  83. }
  84. public IEntityViewBuilder[] entityViewsToBuild
  85. {
  86. get { return _entityViewsToBuild; }
  87. }
  88. static readonly IEntityViewBuilder[] _entityViewsToBuild;
  89. }
  90. }