@esengine/ecs-framework 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/index.cjs +2 -0
  2. package/index.cjs.map +1 -0
  3. package/index.d.ts +13466 -0
  4. package/index.es5.js +4 -0
  5. package/index.es5.js.map +1 -0
  6. package/index.mjs +2 -0
  7. package/index.mjs.map +1 -0
  8. package/index.umd.js +4 -0
  9. package/index.umd.js.map +1 -0
  10. package/package.json +47 -84
  11. package/bin/Core/DI/Decorators.d.ts +0 -206
  12. package/bin/Core/DI/Decorators.d.ts.map +0 -1
  13. package/bin/Core/DI/Decorators.js +0 -253
  14. package/bin/Core/DI/Decorators.js.map +0 -1
  15. package/bin/Core/DI/index.d.ts +0 -8
  16. package/bin/Core/DI/index.d.ts.map +0 -1
  17. package/bin/Core/DI/index.js +0 -7
  18. package/bin/Core/DI/index.js.map +0 -1
  19. package/bin/Core/Plugin.d.ts +0 -112
  20. package/bin/Core/Plugin.d.ts.map +0 -1
  21. package/bin/Core/Plugin.js +0 -19
  22. package/bin/Core/Plugin.js.map +0 -1
  23. package/bin/Core/PluginManager.d.ts +0 -118
  24. package/bin/Core/PluginManager.d.ts.map +0 -1
  25. package/bin/Core/PluginManager.js +0 -229
  26. package/bin/Core/PluginManager.js.map +0 -1
  27. package/bin/Core/ServiceContainer.d.ts +0 -221
  28. package/bin/Core/ServiceContainer.d.ts.map +0 -1
  29. package/bin/Core/ServiceContainer.js +0 -352
  30. package/bin/Core/ServiceContainer.js.map +0 -1
  31. package/bin/Core.d.ts +0 -379
  32. package/bin/Core.d.ts.map +0 -1
  33. package/bin/Core.js +0 -553
  34. package/bin/Core.js.map +0 -1
  35. package/bin/ECS/Component.d.ts +0 -104
  36. package/bin/ECS/Component.d.ts.map +0 -1
  37. package/bin/ECS/Component.js +0 -105
  38. package/bin/ECS/Component.js.map +0 -1
  39. package/bin/ECS/Components/HierarchyComponent.d.ts +0 -46
  40. package/bin/ECS/Components/HierarchyComponent.d.ts.map +0 -1
  41. package/bin/ECS/Components/HierarchyComponent.js +0 -65
  42. package/bin/ECS/Components/HierarchyComponent.js.map +0 -1
  43. package/bin/ECS/Components/index.d.ts +0 -2
  44. package/bin/ECS/Components/index.d.ts.map +0 -1
  45. package/bin/ECS/Components/index.js +0 -2
  46. package/bin/ECS/Components/index.js.map +0 -1
  47. package/bin/ECS/Core/ArchetypeSystem.d.ts +0 -103
  48. package/bin/ECS/Core/ArchetypeSystem.d.ts.map +0 -1
  49. package/bin/ECS/Core/ArchetypeSystem.js +0 -244
  50. package/bin/ECS/Core/ArchetypeSystem.js.map +0 -1
  51. package/bin/ECS/Core/CommandBuffer.d.ts +0 -154
  52. package/bin/ECS/Core/CommandBuffer.d.ts.map +0 -1
  53. package/bin/ECS/Core/CommandBuffer.js +0 -244
  54. package/bin/ECS/Core/CommandBuffer.js.map +0 -1
  55. package/bin/ECS/Core/ComponentPool.d.ts +0 -139
  56. package/bin/ECS/Core/ComponentPool.d.ts.map +0 -1
  57. package/bin/ECS/Core/ComponentPool.js +0 -276
  58. package/bin/ECS/Core/ComponentPool.js.map +0 -1
  59. package/bin/ECS/Core/ComponentStorage/ComponentRegistry.d.ts +0 -127
  60. package/bin/ECS/Core/ComponentStorage/ComponentRegistry.d.ts.map +0 -1
  61. package/bin/ECS/Core/ComponentStorage/ComponentRegistry.js +0 -235
  62. package/bin/ECS/Core/ComponentStorage/ComponentRegistry.js.map +0 -1
  63. package/bin/ECS/Core/ComponentStorage.d.ts +0 -185
  64. package/bin/ECS/Core/ComponentStorage.d.ts.map +0 -1
  65. package/bin/ECS/Core/ComponentStorage.js +0 -321
  66. package/bin/ECS/Core/ComponentStorage.js.map +0 -1
  67. package/bin/ECS/Core/EntityLifecyclePolicy.d.ts +0 -26
  68. package/bin/ECS/Core/EntityLifecyclePolicy.d.ts.map +0 -1
  69. package/bin/ECS/Core/EntityLifecyclePolicy.js +0 -2
  70. package/bin/ECS/Core/EntityLifecyclePolicy.js.map +0 -1
  71. package/bin/ECS/Core/EventBus.d.ts +0 -210
  72. package/bin/ECS/Core/EventBus.d.ts.map +0 -1
  73. package/bin/ECS/Core/EventBus.js +0 -370
  74. package/bin/ECS/Core/EventBus.js.map +0 -1
  75. package/bin/ECS/Core/EventSystem.d.ts +0 -225
  76. package/bin/ECS/Core/EventSystem.d.ts.map +0 -1
  77. package/bin/ECS/Core/EventSystem.js +0 -448
  78. package/bin/ECS/Core/EventSystem.js.map +0 -1
  79. package/bin/ECS/Core/Events/index.d.ts +0 -3
  80. package/bin/ECS/Core/Events/index.d.ts.map +0 -1
  81. package/bin/ECS/Core/Events/index.js +0 -3
  82. package/bin/ECS/Core/Events/index.js.map +0 -1
  83. package/bin/ECS/Core/FluentAPI/ComponentBuilder.d.ts +0 -35
  84. package/bin/ECS/Core/FluentAPI/ComponentBuilder.d.ts.map +0 -1
  85. package/bin/ECS/Core/FluentAPI/ComponentBuilder.js +0 -48
  86. package/bin/ECS/Core/FluentAPI/ComponentBuilder.js.map +0 -1
  87. package/bin/ECS/Core/FluentAPI/ECSFluentAPI.d.ts +0 -135
  88. package/bin/ECS/Core/FluentAPI/ECSFluentAPI.d.ts.map +0 -1
  89. package/bin/ECS/Core/FluentAPI/ECSFluentAPI.js +0 -166
  90. package/bin/ECS/Core/FluentAPI/ECSFluentAPI.js.map +0 -1
  91. package/bin/ECS/Core/FluentAPI/EntityBatchOperator.d.ts +0 -58
  92. package/bin/ECS/Core/FluentAPI/EntityBatchOperator.d.ts.map +0 -1
  93. package/bin/ECS/Core/FluentAPI/EntityBatchOperator.js +0 -85
  94. package/bin/ECS/Core/FluentAPI/EntityBatchOperator.js.map +0 -1
  95. package/bin/ECS/Core/FluentAPI/EntityBuilder.d.ts +0 -110
  96. package/bin/ECS/Core/FluentAPI/EntityBuilder.d.ts.map +0 -1
  97. package/bin/ECS/Core/FluentAPI/EntityBuilder.js +0 -181
  98. package/bin/ECS/Core/FluentAPI/EntityBuilder.js.map +0 -1
  99. package/bin/ECS/Core/FluentAPI/SceneBuilder.d.ts +0 -53
  100. package/bin/ECS/Core/FluentAPI/SceneBuilder.d.ts.map +0 -1
  101. package/bin/ECS/Core/FluentAPI/SceneBuilder.js +0 -79
  102. package/bin/ECS/Core/FluentAPI/SceneBuilder.js.map +0 -1
  103. package/bin/ECS/Core/FluentAPI/index.d.ts +0 -6
  104. package/bin/ECS/Core/FluentAPI/index.d.ts.map +0 -1
  105. package/bin/ECS/Core/FluentAPI/index.js +0 -6
  106. package/bin/ECS/Core/FluentAPI/index.js.map +0 -1
  107. package/bin/ECS/Core/FluentAPI.d.ts +0 -2
  108. package/bin/ECS/Core/FluentAPI.d.ts.map +0 -1
  109. package/bin/ECS/Core/FluentAPI.js +0 -3
  110. package/bin/ECS/Core/FluentAPI.js.map +0 -1
  111. package/bin/ECS/Core/Query/TypedQuery.d.ts +0 -214
  112. package/bin/ECS/Core/Query/TypedQuery.d.ts.map +0 -1
  113. package/bin/ECS/Core/Query/TypedQuery.js +0 -294
  114. package/bin/ECS/Core/Query/TypedQuery.js.map +0 -1
  115. package/bin/ECS/Core/Query/index.d.ts +0 -3
  116. package/bin/ECS/Core/Query/index.d.ts.map +0 -1
  117. package/bin/ECS/Core/Query/index.js +0 -3
  118. package/bin/ECS/Core/Query/index.js.map +0 -1
  119. package/bin/ECS/Core/QuerySystem.d.ts +0 -458
  120. package/bin/ECS/Core/QuerySystem.d.ts.map +0 -1
  121. package/bin/ECS/Core/QuerySystem.js +0 -1069
  122. package/bin/ECS/Core/QuerySystem.js.map +0 -1
  123. package/bin/ECS/Core/QueryTypes.d.ts +0 -34
  124. package/bin/ECS/Core/QueryTypes.d.ts.map +0 -1
  125. package/bin/ECS/Core/QueryTypes.js +0 -13
  126. package/bin/ECS/Core/QueryTypes.js.map +0 -1
  127. package/bin/ECS/Core/ReactiveQuery.d.ts +0 -211
  128. package/bin/ECS/Core/ReactiveQuery.d.ts.map +0 -1
  129. package/bin/ECS/Core/ReactiveQuery.js +0 -401
  130. package/bin/ECS/Core/ReactiveQuery.js.map +0 -1
  131. package/bin/ECS/Core/ReferenceTracker.d.ts +0 -111
  132. package/bin/ECS/Core/ReferenceTracker.d.ts.map +0 -1
  133. package/bin/ECS/Core/ReferenceTracker.js +0 -254
  134. package/bin/ECS/Core/ReferenceTracker.js.map +0 -1
  135. package/bin/ECS/Core/SoASerializer.d.ts +0 -28
  136. package/bin/ECS/Core/SoASerializer.d.ts.map +0 -1
  137. package/bin/ECS/Core/SoASerializer.js +0 -85
  138. package/bin/ECS/Core/SoASerializer.js.map +0 -1
  139. package/bin/ECS/Core/SoAStorage.d.ts +0 -129
  140. package/bin/ECS/Core/SoAStorage.d.ts.map +0 -1
  141. package/bin/ECS/Core/SoAStorage.js +0 -685
  142. package/bin/ECS/Core/SoAStorage.js.map +0 -1
  143. package/bin/ECS/Core/SoATypeRegistry.d.ts +0 -50
  144. package/bin/ECS/Core/SoATypeRegistry.d.ts.map +0 -1
  145. package/bin/ECS/Core/SoATypeRegistry.js +0 -135
  146. package/bin/ECS/Core/SoATypeRegistry.js.map +0 -1
  147. package/bin/ECS/Core/Storage/index.d.ts +0 -4
  148. package/bin/ECS/Core/Storage/index.d.ts.map +0 -1
  149. package/bin/ECS/Core/Storage/index.js +0 -4
  150. package/bin/ECS/Core/Storage/index.js.map +0 -1
  151. package/bin/ECS/Core/StorageDecorators.d.ts +0 -20
  152. package/bin/ECS/Core/StorageDecorators.d.ts.map +0 -1
  153. package/bin/ECS/Core/StorageDecorators.js +0 -27
  154. package/bin/ECS/Core/StorageDecorators.js.map +0 -1
  155. package/bin/ECS/CoreEvents.d.ts +0 -131
  156. package/bin/ECS/CoreEvents.d.ts.map +0 -1
  157. package/bin/ECS/CoreEvents.js +0 -163
  158. package/bin/ECS/CoreEvents.js.map +0 -1
  159. package/bin/ECS/Decorators/EntityRefDecorator.d.ts +0 -46
  160. package/bin/ECS/Decorators/EntityRefDecorator.d.ts.map +0 -1
  161. package/bin/ECS/Decorators/EntityRefDecorator.js +0 -118
  162. package/bin/ECS/Decorators/EntityRefDecorator.js.map +0 -1
  163. package/bin/ECS/Decorators/PropertyDecorator.d.ts +0 -168
  164. package/bin/ECS/Decorators/PropertyDecorator.d.ts.map +0 -1
  165. package/bin/ECS/Decorators/PropertyDecorator.js +0 -40
  166. package/bin/ECS/Decorators/PropertyDecorator.js.map +0 -1
  167. package/bin/ECS/Decorators/TypeDecorators.d.ts +0 -124
  168. package/bin/ECS/Decorators/TypeDecorators.d.ts.map +0 -1
  169. package/bin/ECS/Decorators/TypeDecorators.js +0 -151
  170. package/bin/ECS/Decorators/TypeDecorators.js.map +0 -1
  171. package/bin/ECS/Decorators/index.d.ts +0 -7
  172. package/bin/ECS/Decorators/index.d.ts.map +0 -1
  173. package/bin/ECS/Decorators/index.js +0 -4
  174. package/bin/ECS/Decorators/index.js.map +0 -1
  175. package/bin/ECS/Entity.d.ts +0 -415
  176. package/bin/ECS/Entity.d.ts.map +0 -1
  177. package/bin/ECS/Entity.js +0 -683
  178. package/bin/ECS/Entity.js.map +0 -1
  179. package/bin/ECS/EntityTags.d.ts +0 -71
  180. package/bin/ECS/EntityTags.d.ts.map +0 -1
  181. package/bin/ECS/EntityTags.js +0 -82
  182. package/bin/ECS/EntityTags.js.map +0 -1
  183. package/bin/ECS/IScene.d.ts +0 -308
  184. package/bin/ECS/IScene.d.ts.map +0 -1
  185. package/bin/ECS/IScene.js +0 -2
  186. package/bin/ECS/IScene.js.map +0 -1
  187. package/bin/ECS/Scene.d.ts +0 -799
  188. package/bin/ECS/Scene.d.ts.map +0 -1
  189. package/bin/ECS/Scene.js +0 -1203
  190. package/bin/ECS/Scene.js.map +0 -1
  191. package/bin/ECS/SceneManager.d.ts +0 -197
  192. package/bin/ECS/SceneManager.d.ts.map +0 -1
  193. package/bin/ECS/SceneManager.js +0 -264
  194. package/bin/ECS/SceneManager.js.map +0 -1
  195. package/bin/ECS/Serialization/ComponentSerializer.d.ts +0 -106
  196. package/bin/ECS/Serialization/ComponentSerializer.d.ts.map +0 -1
  197. package/bin/ECS/Serialization/ComponentSerializer.js +0 -251
  198. package/bin/ECS/Serialization/ComponentSerializer.js.map +0 -1
  199. package/bin/ECS/Serialization/EntitySerializer.d.ts +0 -111
  200. package/bin/ECS/Serialization/EntitySerializer.d.ts.map +0 -1
  201. package/bin/ECS/Serialization/EntitySerializer.js +0 -155
  202. package/bin/ECS/Serialization/EntitySerializer.js.map +0 -1
  203. package/bin/ECS/Serialization/IncrementalSerializer.d.ts +0 -259
  204. package/bin/ECS/Serialization/IncrementalSerializer.d.ts.map +0 -1
  205. package/bin/ECS/Serialization/IncrementalSerializer.js +0 -500
  206. package/bin/ECS/Serialization/IncrementalSerializer.js.map +0 -1
  207. package/bin/ECS/Serialization/SceneSerializer.d.ts +0 -213
  208. package/bin/ECS/Serialization/SceneSerializer.d.ts.map +0 -1
  209. package/bin/ECS/Serialization/SceneSerializer.js +0 -387
  210. package/bin/ECS/Serialization/SceneSerializer.js.map +0 -1
  211. package/bin/ECS/Serialization/SerializationDecorators.d.ts +0 -136
  212. package/bin/ECS/Serialization/SerializationDecorators.d.ts.map +0 -1
  213. package/bin/ECS/Serialization/SerializationDecorators.js +0 -216
  214. package/bin/ECS/Serialization/SerializationDecorators.js.map +0 -1
  215. package/bin/ECS/Serialization/VersionMigration.d.ts +0 -156
  216. package/bin/ECS/Serialization/VersionMigration.d.ts.map +0 -1
  217. package/bin/ECS/Serialization/VersionMigration.js +0 -279
  218. package/bin/ECS/Serialization/VersionMigration.js.map +0 -1
  219. package/bin/ECS/Serialization/index.d.ts +0 -18
  220. package/bin/ECS/Serialization/index.d.ts.map +0 -1
  221. package/bin/ECS/Serialization/index.js +0 -18
  222. package/bin/ECS/Serialization/index.js.map +0 -1
  223. package/bin/ECS/Systems/EntityCache.d.ts +0 -114
  224. package/bin/ECS/Systems/EntityCache.d.ts.map +0 -1
  225. package/bin/ECS/Systems/EntityCache.js +0 -145
  226. package/bin/ECS/Systems/EntityCache.js.map +0 -1
  227. package/bin/ECS/Systems/EntitySystem.d.ts +0 -591
  228. package/bin/ECS/Systems/EntitySystem.d.ts.map +0 -1
  229. package/bin/ECS/Systems/EntitySystem.js +0 -1102
  230. package/bin/ECS/Systems/EntitySystem.js.map +0 -1
  231. package/bin/ECS/Systems/HierarchySystem.d.ts +0 -155
  232. package/bin/ECS/Systems/HierarchySystem.d.ts.map +0 -1
  233. package/bin/ECS/Systems/HierarchySystem.js +0 -498
  234. package/bin/ECS/Systems/HierarchySystem.js.map +0 -1
  235. package/bin/ECS/Systems/IntervalSystem.d.ts +0 -33
  236. package/bin/ECS/Systems/IntervalSystem.d.ts.map +0 -1
  237. package/bin/ECS/Systems/IntervalSystem.js +0 -50
  238. package/bin/ECS/Systems/IntervalSystem.js.map +0 -1
  239. package/bin/ECS/Systems/PassiveSystem.d.ts +0 -17
  240. package/bin/ECS/Systems/PassiveSystem.d.ts.map +0 -1
  241. package/bin/ECS/Systems/PassiveSystem.js +0 -19
  242. package/bin/ECS/Systems/PassiveSystem.js.map +0 -1
  243. package/bin/ECS/Systems/ProcessingSystem.d.ts +0 -21
  244. package/bin/ECS/Systems/ProcessingSystem.d.ts.map +0 -1
  245. package/bin/ECS/Systems/ProcessingSystem.js +0 -20
  246. package/bin/ECS/Systems/ProcessingSystem.js.map +0 -1
  247. package/bin/ECS/Systems/WorkerEntitySystem.d.ts +0 -313
  248. package/bin/ECS/Systems/WorkerEntitySystem.d.ts.map +0 -1
  249. package/bin/ECS/Systems/WorkerEntitySystem.js +0 -792
  250. package/bin/ECS/Systems/WorkerEntitySystem.js.map +0 -1
  251. package/bin/ECS/Systems/index.d.ts +0 -8
  252. package/bin/ECS/Systems/index.d.ts.map +0 -1
  253. package/bin/ECS/Systems/index.js +0 -8
  254. package/bin/ECS/Systems/index.js.map +0 -1
  255. package/bin/ECS/TypedEntity.d.ts +0 -192
  256. package/bin/ECS/TypedEntity.d.ts.map +0 -1
  257. package/bin/ECS/TypedEntity.js +0 -254
  258. package/bin/ECS/TypedEntity.js.map +0 -1
  259. package/bin/ECS/Utils/BigIntCompatibility.d.ts +0 -151
  260. package/bin/ECS/Utils/BigIntCompatibility.d.ts.map +0 -1
  261. package/bin/ECS/Utils/BigIntCompatibility.js +0 -476
  262. package/bin/ECS/Utils/BigIntCompatibility.js.map +0 -1
  263. package/bin/ECS/Utils/BitMaskHashMap.d.ts +0 -28
  264. package/bin/ECS/Utils/BitMaskHashMap.d.ts.map +0 -1
  265. package/bin/ECS/Utils/BitMaskHashMap.js +0 -127
  266. package/bin/ECS/Utils/BitMaskHashMap.js.map +0 -1
  267. package/bin/ECS/Utils/Bits.d.ts +0 -154
  268. package/bin/ECS/Utils/Bits.d.ts.map +0 -1
  269. package/bin/ECS/Utils/Bits.js +0 -331
  270. package/bin/ECS/Utils/Bits.js.map +0 -1
  271. package/bin/ECS/Utils/ComponentSparseSet.d.ts +0 -143
  272. package/bin/ECS/Utils/ComponentSparseSet.d.ts.map +0 -1
  273. package/bin/ECS/Utils/ComponentSparseSet.js +0 -347
  274. package/bin/ECS/Utils/ComponentSparseSet.js.map +0 -1
  275. package/bin/ECS/Utils/EntityList.d.ts +0 -115
  276. package/bin/ECS/Utils/EntityList.d.ts.map +0 -1
  277. package/bin/ECS/Utils/EntityList.js +0 -258
  278. package/bin/ECS/Utils/EntityList.js.map +0 -1
  279. package/bin/ECS/Utils/EntityProcessorList.d.ts +0 -56
  280. package/bin/ECS/Utils/EntityProcessorList.d.ts.map +0 -1
  281. package/bin/ECS/Utils/EntityProcessorList.js +0 -113
  282. package/bin/ECS/Utils/EntityProcessorList.js.map +0 -1
  283. package/bin/ECS/Utils/IdentifierPool.d.ts +0 -203
  284. package/bin/ECS/Utils/IdentifierPool.d.ts.map +0 -1
  285. package/bin/ECS/Utils/IdentifierPool.js +0 -325
  286. package/bin/ECS/Utils/IdentifierPool.js.map +0 -1
  287. package/bin/ECS/Utils/Matcher.d.ts +0 -171
  288. package/bin/ECS/Utils/Matcher.d.ts.map +0 -1
  289. package/bin/ECS/Utils/Matcher.js +0 -293
  290. package/bin/ECS/Utils/Matcher.js.map +0 -1
  291. package/bin/ECS/Utils/SparseSet.d.ts +0 -170
  292. package/bin/ECS/Utils/SparseSet.d.ts.map +0 -1
  293. package/bin/ECS/Utils/SparseSet.js +0 -280
  294. package/bin/ECS/Utils/SparseSet.js.map +0 -1
  295. package/bin/ECS/Utils/index.d.ts +0 -9
  296. package/bin/ECS/Utils/index.d.ts.map +0 -1
  297. package/bin/ECS/Utils/index.js +0 -10
  298. package/bin/ECS/Utils/index.js.map +0 -1
  299. package/bin/ECS/World.d.ts +0 -238
  300. package/bin/ECS/World.d.ts.map +0 -1
  301. package/bin/ECS/World.js +0 -416
  302. package/bin/ECS/World.js.map +0 -1
  303. package/bin/ECS/WorldManager.d.ts +0 -224
  304. package/bin/ECS/WorldManager.d.ts.map +0 -1
  305. package/bin/ECS/WorldManager.js +0 -365
  306. package/bin/ECS/WorldManager.js.map +0 -1
  307. package/bin/ECS/index.d.ts +0 -26
  308. package/bin/ECS/index.d.ts.map +0 -1
  309. package/bin/ECS/index.js +0 -21
  310. package/bin/ECS/index.js.map +0 -1
  311. package/bin/Platform/IPlatformAdapter.d.ts +0 -169
  312. package/bin/Platform/IPlatformAdapter.d.ts.map +0 -1
  313. package/bin/Platform/IPlatformAdapter.js +0 -2
  314. package/bin/Platform/IPlatformAdapter.js.map +0 -1
  315. package/bin/Platform/PlatformDetector.d.ts +0 -56
  316. package/bin/Platform/PlatformDetector.d.ts.map +0 -1
  317. package/bin/Platform/PlatformDetector.js +0 -247
  318. package/bin/Platform/PlatformDetector.js.map +0 -1
  319. package/bin/Platform/PlatformManager.d.ts +0 -50
  320. package/bin/Platform/PlatformManager.d.ts.map +0 -1
  321. package/bin/Platform/PlatformManager.js +0 -114
  322. package/bin/Platform/PlatformManager.js.map +0 -1
  323. package/bin/Platform/index.d.ts +0 -19
  324. package/bin/Platform/index.d.ts.map +0 -1
  325. package/bin/Platform/index.js +0 -29
  326. package/bin/Platform/index.js.map +0 -1
  327. package/bin/Plugins/DebugPlugin.d.ts +0 -156
  328. package/bin/Plugins/DebugPlugin.d.ts.map +0 -1
  329. package/bin/Plugins/DebugPlugin.js +0 -248
  330. package/bin/Plugins/DebugPlugin.js.map +0 -1
  331. package/bin/Plugins/index.d.ts +0 -2
  332. package/bin/Plugins/index.d.ts.map +0 -1
  333. package/bin/Plugins/index.js +0 -2
  334. package/bin/Plugins/index.js.map +0 -1
  335. package/bin/Types/IUpdatable.d.ts +0 -18
  336. package/bin/Types/IUpdatable.d.ts.map +0 -1
  337. package/bin/Types/IUpdatable.js +0 -7
  338. package/bin/Types/IUpdatable.js.map +0 -1
  339. package/bin/Types/TypeHelpers.d.ts +0 -238
  340. package/bin/Types/TypeHelpers.d.ts.map +0 -1
  341. package/bin/Types/TypeHelpers.js +0 -19
  342. package/bin/Types/TypeHelpers.js.map +0 -1
  343. package/bin/Types/index.d.ts +0 -466
  344. package/bin/Types/index.d.ts.map +0 -1
  345. package/bin/Types/index.js +0 -7
  346. package/bin/Types/index.js.map +0 -1
  347. package/bin/Utils/BinarySerializer.d.ts +0 -23
  348. package/bin/Utils/BinarySerializer.d.ts.map +0 -1
  349. package/bin/Utils/BinarySerializer.js +0 -100
  350. package/bin/Utils/BinarySerializer.js.map +0 -1
  351. package/bin/Utils/Debug/AdvancedProfilerCollector.d.ts +0 -153
  352. package/bin/Utils/Debug/AdvancedProfilerCollector.d.ts.map +0 -1
  353. package/bin/Utils/Debug/AdvancedProfilerCollector.js +0 -406
  354. package/bin/Utils/Debug/AdvancedProfilerCollector.js.map +0 -1
  355. package/bin/Utils/Debug/ComponentDataCollector.d.ts +0 -32
  356. package/bin/Utils/Debug/ComponentDataCollector.d.ts.map +0 -1
  357. package/bin/Utils/Debug/ComponentDataCollector.js +0 -250
  358. package/bin/Utils/Debug/ComponentDataCollector.js.map +0 -1
  359. package/bin/Utils/Debug/DebugConfigService.d.ts +0 -16
  360. package/bin/Utils/Debug/DebugConfigService.d.ts.map +0 -1
  361. package/bin/Utils/Debug/DebugConfigService.js +0 -42
  362. package/bin/Utils/Debug/DebugConfigService.js.map +0 -1
  363. package/bin/Utils/Debug/DebugManager.d.ts +0 -131
  364. package/bin/Utils/Debug/DebugManager.d.ts.map +0 -1
  365. package/bin/Utils/Debug/DebugManager.js +0 -848
  366. package/bin/Utils/Debug/DebugManager.js.map +0 -1
  367. package/bin/Utils/Debug/EntityDataCollector.d.ts +0 -115
  368. package/bin/Utils/Debug/EntityDataCollector.d.ts.map +0 -1
  369. package/bin/Utils/Debug/EntityDataCollector.js +0 -870
  370. package/bin/Utils/Debug/EntityDataCollector.js.map +0 -1
  371. package/bin/Utils/Debug/PerformanceDataCollector.d.ts +0 -31
  372. package/bin/Utils/Debug/PerformanceDataCollector.d.ts.map +0 -1
  373. package/bin/Utils/Debug/PerformanceDataCollector.js +0 -203
  374. package/bin/Utils/Debug/PerformanceDataCollector.js.map +0 -1
  375. package/bin/Utils/Debug/SceneDataCollector.d.ts +0 -18
  376. package/bin/Utils/Debug/SceneDataCollector.d.ts.map +0 -1
  377. package/bin/Utils/Debug/SceneDataCollector.js +0 -43
  378. package/bin/Utils/Debug/SceneDataCollector.js.map +0 -1
  379. package/bin/Utils/Debug/SystemDataCollector.d.ts +0 -14
  380. package/bin/Utils/Debug/SystemDataCollector.d.ts.map +0 -1
  381. package/bin/Utils/Debug/SystemDataCollector.js +0 -60
  382. package/bin/Utils/Debug/SystemDataCollector.js.map +0 -1
  383. package/bin/Utils/Debug/WebSocketManager.d.ts +0 -54
  384. package/bin/Utils/Debug/WebSocketManager.d.ts.map +0 -1
  385. package/bin/Utils/Debug/WebSocketManager.js +0 -141
  386. package/bin/Utils/Debug/WebSocketManager.js.map +0 -1
  387. package/bin/Utils/Debug/index.d.ts +0 -11
  388. package/bin/Utils/Debug/index.d.ts.map +0 -1
  389. package/bin/Utils/Debug/index.js +0 -10
  390. package/bin/Utils/Debug/index.js.map +0 -1
  391. package/bin/Utils/Emitter.d.ts +0 -61
  392. package/bin/Utils/Emitter.d.ts.map +0 -1
  393. package/bin/Utils/Emitter.js +0 -101
  394. package/bin/Utils/Emitter.js.map +0 -1
  395. package/bin/Utils/Extensions/NumberExtension.d.ts +0 -13
  396. package/bin/Utils/Extensions/NumberExtension.d.ts.map +0 -1
  397. package/bin/Utils/Extensions/NumberExtension.js +0 -17
  398. package/bin/Utils/Extensions/NumberExtension.js.map +0 -1
  399. package/bin/Utils/Extensions/TypeUtils.d.ts +0 -13
  400. package/bin/Utils/Extensions/TypeUtils.d.ts.map +0 -1
  401. package/bin/Utils/Extensions/TypeUtils.js +0 -15
  402. package/bin/Utils/Extensions/TypeUtils.js.map +0 -1
  403. package/bin/Utils/Extensions/index.d.ts +0 -3
  404. package/bin/Utils/Extensions/index.d.ts.map +0 -1
  405. package/bin/Utils/Extensions/index.js +0 -4
  406. package/bin/Utils/Extensions/index.js.map +0 -1
  407. package/bin/Utils/GlobalManager.d.ts +0 -29
  408. package/bin/Utils/GlobalManager.d.ts.map +0 -1
  409. package/bin/Utils/GlobalManager.js +0 -50
  410. package/bin/Utils/GlobalManager.js.map +0 -1
  411. package/bin/Utils/Logger/ConsoleLogger.d.ts +0 -74
  412. package/bin/Utils/Logger/ConsoleLogger.d.ts.map +0 -1
  413. package/bin/Utils/Logger/ConsoleLogger.js +0 -187
  414. package/bin/Utils/Logger/ConsoleLogger.js.map +0 -1
  415. package/bin/Utils/Logger/Constants.d.ts +0 -36
  416. package/bin/Utils/Logger/Constants.d.ts.map +0 -1
  417. package/bin/Utils/Logger/Constants.js +0 -40
  418. package/bin/Utils/Logger/Constants.js.map +0 -1
  419. package/bin/Utils/Logger/LoggerManager.d.ts +0 -91
  420. package/bin/Utils/Logger/LoggerManager.d.ts.map +0 -1
  421. package/bin/Utils/Logger/LoggerManager.js +0 -167
  422. package/bin/Utils/Logger/LoggerManager.js.map +0 -1
  423. package/bin/Utils/Logger/Types.d.ts +0 -40
  424. package/bin/Utils/Logger/Types.d.ts.map +0 -1
  425. package/bin/Utils/Logger/Types.js +0 -2
  426. package/bin/Utils/Logger/Types.js.map +0 -1
  427. package/bin/Utils/Logger/index.d.ts +0 -5
  428. package/bin/Utils/Logger/index.d.ts.map +0 -1
  429. package/bin/Utils/Logger/index.js +0 -5
  430. package/bin/Utils/Logger/index.js.map +0 -1
  431. package/bin/Utils/PerformanceMonitor.d.ts +0 -196
  432. package/bin/Utils/PerformanceMonitor.d.ts.map +0 -1
  433. package/bin/Utils/PerformanceMonitor.js +0 -244
  434. package/bin/Utils/PerformanceMonitor.js.map +0 -1
  435. package/bin/Utils/Pool/IPoolable.d.ts +0 -29
  436. package/bin/Utils/Pool/IPoolable.d.ts.map +0 -1
  437. package/bin/Utils/Pool/IPoolable.js +0 -2
  438. package/bin/Utils/Pool/IPoolable.js.map +0 -1
  439. package/bin/Utils/Pool/Pool.d.ts +0 -109
  440. package/bin/Utils/Pool/Pool.d.ts.map +0 -1
  441. package/bin/Utils/Pool/Pool.js +0 -238
  442. package/bin/Utils/Pool/Pool.js.map +0 -1
  443. package/bin/Utils/Pool/PoolManager.d.ts +0 -96
  444. package/bin/Utils/Pool/PoolManager.d.ts.map +0 -1
  445. package/bin/Utils/Pool/PoolManager.js +0 -199
  446. package/bin/Utils/Pool/PoolManager.js.map +0 -1
  447. package/bin/Utils/Pool/index.d.ts +0 -4
  448. package/bin/Utils/Pool/index.d.ts.map +0 -1
  449. package/bin/Utils/Pool/index.js +0 -4
  450. package/bin/Utils/Pool/index.js.map +0 -1
  451. package/bin/Utils/Profiler/AutoProfiler.d.ts +0 -160
  452. package/bin/Utils/Profiler/AutoProfiler.d.ts.map +0 -1
  453. package/bin/Utils/Profiler/AutoProfiler.js +0 -503
  454. package/bin/Utils/Profiler/AutoProfiler.js.map +0 -1
  455. package/bin/Utils/Profiler/ProfilerSDK.d.ts +0 -175
  456. package/bin/Utils/Profiler/ProfilerSDK.d.ts.map +0 -1
  457. package/bin/Utils/Profiler/ProfilerSDK.js +0 -727
  458. package/bin/Utils/Profiler/ProfilerSDK.js.map +0 -1
  459. package/bin/Utils/Profiler/ProfilerTypes.d.ts +0 -218
  460. package/bin/Utils/Profiler/ProfilerTypes.d.ts.map +0 -1
  461. package/bin/Utils/Profiler/ProfilerTypes.js +0 -47
  462. package/bin/Utils/Profiler/ProfilerTypes.js.map +0 -1
  463. package/bin/Utils/Profiler/index.d.ts +0 -8
  464. package/bin/Utils/Profiler/index.d.ts.map +0 -1
  465. package/bin/Utils/Profiler/index.js +0 -7
  466. package/bin/Utils/Profiler/index.js.map +0 -1
  467. package/bin/Utils/Time.d.ts +0 -47
  468. package/bin/Utils/Time.d.ts.map +0 -1
  469. package/bin/Utils/Time.js +0 -64
  470. package/bin/Utils/Time.js.map +0 -1
  471. package/bin/Utils/Timers/ITimer.d.ts +0 -16
  472. package/bin/Utils/Timers/ITimer.d.ts.map +0 -1
  473. package/bin/Utils/Timers/ITimer.js +0 -2
  474. package/bin/Utils/Timers/ITimer.js.map +0 -1
  475. package/bin/Utils/Timers/Timer.d.ts +0 -30
  476. package/bin/Utils/Timers/Timer.d.ts.map +0 -1
  477. package/bin/Utils/Timers/Timer.js +0 -58
  478. package/bin/Utils/Timers/Timer.js.map +0 -1
  479. package/bin/Utils/Timers/TimerManager.d.ts +0 -26
  480. package/bin/Utils/Timers/TimerManager.d.ts.map +0 -1
  481. package/bin/Utils/Timers/TimerManager.js +0 -48
  482. package/bin/Utils/Timers/TimerManager.js.map +0 -1
  483. package/bin/Utils/index.d.ts +0 -11
  484. package/bin/Utils/index.d.ts.map +0 -1
  485. package/bin/Utils/index.js +0 -11
  486. package/bin/Utils/index.js.map +0 -1
  487. package/bin/index.d.ts +0 -29
  488. package/bin/index.d.ts.map +0 -1
  489. package/bin/index.js +0 -36
  490. package/bin/index.js.map +0 -1
@@ -1,1102 +0,0 @@
1
- import { Matcher } from '../Utils/Matcher';
2
- import { getSystemInstanceTypeName } from '../Decorators';
3
- import { createLogger } from '../../Utils/Logger';
4
- import { EntityCache } from './EntityCache';
5
- import { CommandBuffer } from '../Core/CommandBuffer';
6
- /**
7
- * 实体系统的基类
8
- *
9
- * 用于处理一组符合特定条件的实体。系统是ECS架构中的逻辑处理单元,
10
- * 负责对拥有特定组件组合的实体执行业务逻辑。
11
- *
12
- * 支持泛型参数以提供类型安全的组件访问:
13
- *
14
- * @template TComponents - 系统需要的组件类型数组
15
- *
16
- * @example
17
- * ```typescript
18
- * // 传统方式
19
- * class MovementSystem extends EntitySystem {
20
- * constructor() {
21
- * super(Matcher.empty().all(Transform, Velocity));
22
- * }
23
- *
24
- * protected process(entities: readonly Entity[]): void {
25
- * for (const entity of entities) {
26
- * const transform = entity.getComponent(Transform);
27
- * const velocity = entity.getComponent(Velocity);
28
- * transform.position.add(velocity.value);
29
- * }
30
- * }
31
- * }
32
- *
33
- * // 类型安全方式
34
- * class MovementSystem extends EntitySystem<[typeof Transform, typeof Velocity]> {
35
- * constructor() {
36
- * super(Matcher.empty().all(Transform, Velocity));
37
- * }
38
- *
39
- * protected process(entities: readonly Entity[]): void {
40
- * for (const entity of entities) {
41
- * // 类型安全的组件访问
42
- * const [transform, velocity] = this.getComponents(entity);
43
- * transform.position.add(velocity.value);
44
- * }
45
- * }
46
- * }
47
- * ```
48
- */
49
- export class EntitySystem {
50
- /**
51
- * 获取系统处理的实体列表
52
- */
53
- get entities() {
54
- // 如果在update周期内,优先使用帧缓存
55
- const frameCache = this._entityCache.getFrame();
56
- if (frameCache !== null) {
57
- return frameCache;
58
- }
59
- // 否则使用持久缓存
60
- if (!this._entityCache.hasPersistent()) {
61
- this._entityCache.setPersistent(this.queryEntities());
62
- }
63
- return this._entityCache.getPersistent();
64
- }
65
- /**
66
- * 获取系统的更新时序
67
- */
68
- get updateOrder() {
69
- return this._updateOrder;
70
- }
71
- set updateOrder(value) {
72
- this.setUpdateOrder(value);
73
- }
74
- /**
75
- * 获取系统的添加顺序
76
- * Get the add order of the system
77
- * @internal
78
- */
79
- get addOrder() {
80
- return this._addOrder;
81
- }
82
- /**
83
- * 设置系统的添加顺序(由 Scene 在添加时设置)
84
- * Set the add order of the system (set by Scene when adding)
85
- * @internal
86
- */
87
- set addOrder(value) {
88
- this._addOrder = value;
89
- }
90
- /**
91
- * 获取系统的启用状态
92
- */
93
- get enabled() {
94
- return this._enabled;
95
- }
96
- /**
97
- * 设置系统的启用状态
98
- */
99
- set enabled(value) {
100
- this._enabled = value;
101
- }
102
- /**
103
- * 获取系统名称
104
- */
105
- get systemName() {
106
- return this._systemName;
107
- }
108
- constructor(matcher) {
109
- /**
110
- * 命令缓冲区 - 用于延迟执行实体操作
111
- * Command buffer - for deferred entity operations
112
- *
113
- * 在 process() 中使用 commands 可以避免迭代过程中修改实体列表,
114
- * 提高性能并保证迭代安全。命令会在帧末由 Scene 统一执行。
115
- *
116
- * Using commands in process() avoids modifying entity list during iteration,
117
- * improving performance and ensuring iteration safety. Commands are executed by Scene at end of frame.
118
- *
119
- * @example
120
- * ```typescript
121
- * protected process(entities: readonly Entity[]): void {
122
- * for (const entity of entities) {
123
- * if (shouldDie(entity)) {
124
- * // 延迟执行,不影响当前迭代
125
- * this.commands.destroyEntity(entity);
126
- * }
127
- * }
128
- * }
129
- * ```
130
- */
131
- this.commands = new CommandBuffer();
132
- this._updateOrder = 0;
133
- this._addOrder = 0;
134
- this._enabled = true;
135
- this._performanceMonitor = null;
136
- this._systemName = getSystemInstanceTypeName(this);
137
- this._initialized = false;
138
- this._matcher = matcher || Matcher.empty();
139
- this._eventListeners = [];
140
- this._scene = null;
141
- this._destroyed = false;
142
- this._entityIdMap = null;
143
- this._entityIdMapVersion = -1;
144
- // 初始化logger
145
- this.logger = createLogger(this.getLoggerName());
146
- this._entityCache = new EntityCache();
147
- }
148
- /**
149
- * 这个系统所属的场景
150
- */
151
- get scene() {
152
- return this._scene;
153
- }
154
- set scene(value) {
155
- this._scene = value;
156
- // 同步更新 CommandBuffer 的场景引用
157
- // Sync CommandBuffer scene reference
158
- this.commands.setScene(value);
159
- }
160
- /**
161
- * 设置性能监控器
162
- */
163
- setPerformanceMonitor(monitor) {
164
- this._performanceMonitor = monitor;
165
- }
166
- /**
167
- * 获取性能监控器
168
- */
169
- getPerformanceMonitor() {
170
- if (!this._performanceMonitor) {
171
- throw new Error(`${this._systemName}: PerformanceMonitor未注入,请确保在Core.create()之后再添加System到Scene`);
172
- }
173
- return this._performanceMonitor;
174
- }
175
- /**
176
- * 获取实体匹配器
177
- */
178
- get matcher() {
179
- return this._matcher;
180
- }
181
- /**
182
- * 设置更新时序
183
- * @param order 更新时序
184
- */
185
- setUpdateOrder(order) {
186
- if (this._updateOrder === order)
187
- return;
188
- this._updateOrder = order;
189
- this._scene?.markSystemsOrderDirty();
190
- }
191
- /**
192
- * 系统初始化(框架调用)
193
- *
194
- * 在系统创建时调用。框架内部使用,用户不应直接调用。
195
- */
196
- initialize() {
197
- // 防止重复初始化 | Prevent re-initialization
198
- if (this._initialized) {
199
- return;
200
- }
201
- this._initialized = true;
202
- // 框架内部初始化:触发一次实体查询,以便正确跟踪现有实体
203
- // Framework initialization: query entities once to track existing entities
204
- if (this.scene) {
205
- // 清理缓存确保初始化时重新查询 | Clear cache to ensure fresh query
206
- this._entityCache.invalidate();
207
- const entities = this.queryEntities();
208
- // 初始化时对已存在的匹配实体触发 onAdded
209
- // Trigger onAdded for existing matching entities during initialization
210
- for (const entity of entities) {
211
- this.onAdded(entity);
212
- }
213
- }
214
- // 调用用户可重写的初始化方法 | Call user-overridable initialization method
215
- this.onInitialize();
216
- }
217
- /**
218
- * 系统初始化回调
219
- *
220
- * 子类可以重写此方法进行初始化操作。
221
- */
222
- onInitialize() {
223
- // 子类可以重写此方法进行初始化
224
- }
225
- /**
226
- * 清除实体缓存(内部使用)
227
- * 当Scene中的实体发生变化时调用
228
- */
229
- clearEntityCache() {
230
- this._entityCache.invalidate();
231
- }
232
- /**
233
- * 完全重置实体跟踪状态
234
- * 清除所有缓存和跟踪的实体,强制下次 update 时重新扫描所有实体并触发 onAdded
235
- * 用于场景重载/预览重置等场景
236
- */
237
- resetEntityTracking() {
238
- this._entityCache.clearAll();
239
- this._entityIdMap = null;
240
- this._entityIdMapVersion = -1;
241
- }
242
- /**
243
- * 重置系统状态
244
- *
245
- * 当系统从场景中移除时调用,重置初始化状态以便重新添加时能正确初始化。
246
- *
247
- * 注意:此方法由 Scene.removeEntityProcessor 调用,在 unregister(触发dispose)之后调用。
248
- * dispose 已经调用了 onDestroy 并设置了 _destroyed 标志,所以这里不需要重置该标志。
249
- * 重置 _destroyed 会违反服务容器的语义(dispose 后不应重用)。
250
- */
251
- reset() {
252
- // 如果系统已经被销毁,不需要再次调用destroy
253
- if (this._destroyed) {
254
- return;
255
- }
256
- this.scene = null;
257
- this._initialized = false;
258
- this._entityCache.clearAll();
259
- // 清理实体ID映射缓存
260
- this._entityIdMap = null;
261
- this._entityIdMapVersion = -1;
262
- // 清理所有事件监听器并调用销毁回调
263
- this.destroy();
264
- }
265
- /**
266
- * 查询匹配的实体
267
- */
268
- queryEntities() {
269
- if (!this.scene?.querySystem || !this._matcher) {
270
- return [];
271
- }
272
- const condition = this._matcher.getCondition();
273
- const querySystem = this.scene.querySystem;
274
- let currentEntities = [];
275
- // matchNothing 条件返回空数组(用于只需要生命周期方法的系统)
276
- if (this._matcher.isNothing()) {
277
- return [];
278
- }
279
- // 空条件返回所有实体
280
- if (this._matcher.isEmpty()) {
281
- currentEntities = querySystem.getAllEntities();
282
- }
283
- else if (this.isSingleCondition(condition)) {
284
- // 单一条件优化查询
285
- currentEntities = this.executeSingleConditionQuery(condition, querySystem);
286
- }
287
- else {
288
- // 复合查询
289
- currentEntities = this.executeComplexQuery(condition, querySystem);
290
- }
291
- // 检查实体变化并触发回调
292
- this.updateEntityTracking(currentEntities);
293
- return currentEntities;
294
- }
295
- /**
296
- * 检查是否为单一条件查询
297
- *
298
- * 使用位运算优化多条件检测。将每种查询条件映射到不同的位:
299
- * - all: 第0位 (1)
300
- * - any: 第1位 (2)
301
- * - none: 第2位 (4)
302
- * - tag: 第3位 (8)
303
- * - name: 第4位 (16)
304
- * - component: 第5位 (32)
305
- */
306
- isSingleCondition(condition) {
307
- // 使用位OR运算合并所有条件标记
308
- const flags = (condition.all.length > 0 ? 1 : 0) |
309
- (condition.any.length > 0 ? 2 : 0) |
310
- (condition.none.length > 0 ? 4 : 0) |
311
- (condition.tag !== undefined ? 8 : 0) |
312
- (condition.name !== undefined ? 16 : 0) |
313
- (condition.component !== undefined ? 32 : 0);
314
- // 位运算技巧:如果只有一个位被设置,则 flags & (flags - 1) == 0
315
- // 例如:flags=4 (100), flags-1=3 (011), 4&3=0
316
- // 但如果 flags=6 (110), flags-1=5 (101), 6&5=4≠0
317
- return flags !== 0 && (flags & (flags - 1)) === 0;
318
- }
319
- /**
320
- * 执行单一条件查询
321
- */
322
- executeSingleConditionQuery(condition, querySystem) {
323
- // 按标签查询
324
- if (condition.tag !== undefined) {
325
- return querySystem.queryByTag(condition.tag).entities;
326
- }
327
- // 按名称查询
328
- if (condition.name !== undefined) {
329
- return querySystem.queryByName(condition.name).entities;
330
- }
331
- // 单组件查询
332
- if (condition.component !== undefined) {
333
- return querySystem.queryByComponent(condition.component).entities;
334
- }
335
- // 基础组件查询
336
- if (condition.all.length > 0 && condition.any.length === 0 && condition.none.length === 0) {
337
- return querySystem.queryAll(...condition.all).entities;
338
- }
339
- if (condition.all.length === 0 && condition.any.length > 0 && condition.none.length === 0) {
340
- return querySystem.queryAny(...condition.any).entities;
341
- }
342
- if (condition.all.length === 0 && condition.any.length === 0 && condition.none.length > 0) {
343
- return querySystem.queryNone(...condition.none).entities;
344
- }
345
- return [];
346
- }
347
- /**
348
- * 执行复合查询
349
- */
350
- executeComplexQueryWithIdSets(condition, querySystem) {
351
- let resultIds = null;
352
- // 1. 应用标签条件作为基础集合
353
- if (condition.tag !== undefined) {
354
- const tagResult = querySystem.queryByTag(condition.tag);
355
- resultIds = this.extractEntityIds(tagResult.entities);
356
- }
357
- // 2. 应用名称条件 (交集)
358
- if (condition.name !== undefined) {
359
- const nameIds = this.extractEntityIds(querySystem.queryByName(condition.name).entities);
360
- resultIds = resultIds ? this.intersectIdSets(resultIds, nameIds) : nameIds;
361
- }
362
- // 3. 应用单组件条件 (交集)
363
- if (condition.component !== undefined) {
364
- const componentIds = this.extractEntityIds(querySystem.queryByComponent(condition.component).entities);
365
- resultIds = resultIds ? this.intersectIdSets(resultIds, componentIds) : componentIds;
366
- }
367
- // 4. 应用all条件 (交集)
368
- if (condition.all.length > 0) {
369
- const allIds = this.extractEntityIds(querySystem.queryAll(...condition.all).entities);
370
- resultIds = resultIds ? this.intersectIdSets(resultIds, allIds) : allIds;
371
- }
372
- // 5. 应用any条件 (交集)
373
- if (condition.any.length > 0) {
374
- const anyIds = this.extractEntityIds(querySystem.queryAny(...condition.any).entities);
375
- resultIds = resultIds ? this.intersectIdSets(resultIds, anyIds) : anyIds;
376
- }
377
- // 6. 应用none条件 (差集)
378
- if (condition.none.length > 0) {
379
- if (!resultIds) {
380
- resultIds = this.extractEntityIds(querySystem.getAllEntities());
381
- }
382
- const noneResult = querySystem.queryAny(...condition.none);
383
- const noneIds = this.extractEntityIds(noneResult.entities);
384
- resultIds = this.differenceIdSets(resultIds, noneIds);
385
- }
386
- return resultIds ? this.idSetToEntityArray(resultIds, querySystem.getAllEntities()) : [];
387
- }
388
- /**
389
- * 提取实体ID集合
390
- */
391
- extractEntityIds(entities) {
392
- const len = entities.length;
393
- const idSet = new Set();
394
- for (let i = 0; i < len; i = (i + 1) | 0) {
395
- idSet.add(entities[i].id | 0);
396
- }
397
- return idSet;
398
- }
399
- /**
400
- * ID集合交集运算
401
- */
402
- intersectIdSets(setA, setB) {
403
- let smaller, larger;
404
- if (setA.size <= setB.size) {
405
- smaller = setA;
406
- larger = setB;
407
- }
408
- else {
409
- smaller = setB;
410
- larger = setA;
411
- }
412
- const result = new Set();
413
- for (const id of smaller) {
414
- if (larger.has(id)) {
415
- result.add(id);
416
- }
417
- }
418
- return result;
419
- }
420
- /**
421
- * ID集合差集运算
422
- */
423
- differenceIdSets(setA, setB) {
424
- const result = new Set();
425
- for (const id of setA) {
426
- if (!setB.has(id)) {
427
- result.add(id);
428
- }
429
- }
430
- return result;
431
- }
432
- /**
433
- * 获取或构建实体ID映射
434
- */
435
- getEntityIdMap(allEntities) {
436
- const currentVersion = this.scene?.querySystem?.version ?? 0;
437
- if (this._entityIdMap !== null && this._entityIdMapVersion === currentVersion) {
438
- return this._entityIdMap;
439
- }
440
- return this.rebuildEntityIdMap(allEntities, currentVersion);
441
- }
442
- /**
443
- * 重建实体ID映射
444
- */
445
- rebuildEntityIdMap(allEntities, version) {
446
- let entityMap = this._entityIdMap;
447
- if (!entityMap) {
448
- entityMap = new Map();
449
- }
450
- else {
451
- entityMap.clear();
452
- }
453
- const len = allEntities.length;
454
- for (let i = 0; i < len; i = (i + 1) | 0) {
455
- const entity = allEntities[i];
456
- entityMap.set(entity.id | 0, entity);
457
- }
458
- this._entityIdMap = entityMap;
459
- this._entityIdMapVersion = version;
460
- return entityMap;
461
- }
462
- /**
463
- * 从ID集合构建Entity数组
464
- */
465
- idSetToEntityArray(idSet, allEntities) {
466
- const entityMap = this.getEntityIdMap(allEntities);
467
- const size = idSet.size;
468
- const result = new Array(size);
469
- let index = 0;
470
- for (const id of idSet) {
471
- const entity = entityMap.get(id);
472
- if (entity !== undefined) {
473
- result[index] = entity;
474
- index = (index + 1) | 0;
475
- }
476
- }
477
- if (index < size) {
478
- result.length = index;
479
- }
480
- return result;
481
- }
482
- /**
483
- * 执行复合查询
484
- *
485
- * 使用基于ID集合的单次扫描算法进行复杂查询
486
- */
487
- executeComplexQuery(condition, querySystem) {
488
- return this.executeComplexQueryWithIdSets(condition, querySystem);
489
- }
490
- /**
491
- * 更新系统
492
- */
493
- update() {
494
- if (!this._enabled || !this.onCheckProcessing()) {
495
- return;
496
- }
497
- const monitor = this.getPerformanceMonitor();
498
- const startTime = monitor.startMonitoring(this._systemName);
499
- let entityCount = 0;
500
- try {
501
- this.onBegin();
502
- // 查询实体并存储到帧缓存中
503
- // ReactiveQuery.getEntities() 返回的是安全快照,只在实体变化时才创建新数组
504
- // ReactiveQuery.getEntities() returns a safe snapshot, only creates new array when entities change
505
- const entities = this.queryEntities();
506
- this._entityCache.setFrame(entities);
507
- entityCount = entities.length;
508
- this.process(entities);
509
- }
510
- finally {
511
- monitor.endMonitoring(this._systemName, startTime, entityCount);
512
- }
513
- }
514
- /**
515
- * 后期更新系统
516
- */
517
- lateUpdate() {
518
- if (!this._enabled || !this.onCheckProcessing()) {
519
- return;
520
- }
521
- const monitor = this.getPerformanceMonitor();
522
- const startTime = monitor.startMonitoring(`${this._systemName}_Late`);
523
- let entityCount = 0;
524
- try {
525
- // 重新查询实体以获取最新列表
526
- // 在 update 和 lateUpdate 之间可能有新组件被添加(事件驱动设计)
527
- // Re-query entities to get the latest list
528
- // New components may have been added between update and lateUpdate (event-driven design)
529
- // ReactiveQuery.getEntities() 返回的是安全快照,只在实体变化时才创建新数组
530
- const entities = this.queryEntities();
531
- this._entityCache.setFrame(entities);
532
- entityCount = entities.length;
533
- this.lateProcess(entities);
534
- this.onEnd();
535
- }
536
- finally {
537
- monitor.endMonitoring(`${this._systemName}_Late`, startTime, entityCount);
538
- // 清理帧缓存
539
- this._entityCache.clearFrame();
540
- }
541
- }
542
- /**
543
- * 执行命令缓冲区中的所有延迟命令
544
- * Flush all deferred commands in the command buffer
545
- *
546
- * 由 Scene 在帧末自动调用。
547
- * Called automatically by Scene at end of frame.
548
- *
549
- * @returns 执行的命令数量 | Number of commands executed
550
- */
551
- flushCommands() {
552
- return this.commands.flush();
553
- }
554
- /**
555
- * 在系统处理开始前调用
556
- *
557
- * 子类可以重写此方法进行预处理操作。
558
- */
559
- onBegin() {
560
- // 子类可以重写此方法
561
- }
562
- /**
563
- * 处理实体列表
564
- *
565
- * 系统的核心逻辑,子类必须实现此方法来定义具体的处理逻辑。
566
- *
567
- * @param entities 要处理的实体列表
568
- */
569
- process(_entities) {
570
- // 子类必须实现此方法
571
- }
572
- /**
573
- * 后期处理实体列表
574
- *
575
- * 在主要处理逻辑之后执行,子类可以重写此方法。
576
- *
577
- * @param entities 要处理的实体列表
578
- */
579
- lateProcess(_entities) {
580
- // 子类可以重写此方法
581
- }
582
- /**
583
- * 系统处理完毕后调用
584
- *
585
- * 子类可以重写此方法进行后处理操作。
586
- */
587
- onEnd() {
588
- // 子类可以重写此方法
589
- }
590
- /**
591
- * 检查系统是否需要处理
592
- *
593
- * 在启用系统时有用,但仅偶尔需要处理。
594
- * 这只影响处理,不影响事件或订阅列表。
595
- *
596
- * @returns 如果系统应该处理,则为true,如果不处理则为false
597
- */
598
- onCheckProcessing() {
599
- return true;
600
- }
601
- /**
602
- * 获取系统的性能数据
603
- *
604
- * @returns 性能数据或undefined
605
- */
606
- getPerformanceData() {
607
- return this.getPerformanceMonitor().getSystemData(this._systemName);
608
- }
609
- /**
610
- * 获取系统的性能统计
611
- *
612
- * @returns 性能统计或undefined
613
- */
614
- getPerformanceStats() {
615
- return this.getPerformanceMonitor().getSystemStats(this._systemName);
616
- }
617
- /**
618
- * 重置系统的性能数据
619
- */
620
- resetPerformanceData() {
621
- this.getPerformanceMonitor().resetSystem(this._systemName);
622
- }
623
- /**
624
- * 获取系统信息的字符串表示
625
- *
626
- * @returns 系统信息字符串
627
- */
628
- toString() {
629
- const entityCount = this.entities.length;
630
- const perfData = this.getPerformanceData();
631
- const perfInfo = perfData ? ` (${perfData.executionTime.toFixed(2)}ms)` : '';
632
- return `${this._systemName}[${entityCount} entities]${perfInfo}`;
633
- }
634
- /**
635
- * 检查实体是否匹配当前系统的查询条件
636
- * Check if an entity matches this system's query condition
637
- *
638
- * @param entity 要检查的实体 / The entity to check
639
- * @returns 是否匹配 / Whether the entity matches
640
- */
641
- matchesEntity(entity) {
642
- if (!this._matcher) {
643
- return false;
644
- }
645
- // nothing 匹配器不匹配任何实体
646
- if (this._matcher.isNothing()) {
647
- return false;
648
- }
649
- // 空匹配器匹配所有实体
650
- if (this._matcher.isEmpty()) {
651
- return true;
652
- }
653
- const condition = this._matcher.getCondition();
654
- // 检查 all 条件
655
- for (const componentType of condition.all) {
656
- if (!entity.hasComponent(componentType)) {
657
- return false;
658
- }
659
- }
660
- // 检查 any 条件
661
- if (condition.any.length > 0) {
662
- let hasAny = false;
663
- for (const componentType of condition.any) {
664
- if (entity.hasComponent(componentType)) {
665
- hasAny = true;
666
- break;
667
- }
668
- }
669
- if (!hasAny) {
670
- return false;
671
- }
672
- }
673
- // 检查 none 条件
674
- for (const componentType of condition.none) {
675
- if (entity.hasComponent(componentType)) {
676
- return false;
677
- }
678
- }
679
- // 检查 tag 条件
680
- if (condition.tag !== undefined && entity.tag !== condition.tag) {
681
- return false;
682
- }
683
- // 检查 name 条件
684
- if (condition.name !== undefined && entity.name !== condition.name) {
685
- return false;
686
- }
687
- // 检查单组件条件
688
- if (condition.component !== undefined && !entity.hasComponent(condition.component)) {
689
- return false;
690
- }
691
- return true;
692
- }
693
- /**
694
- * 检查实体是否正在被此系统跟踪
695
- * Check if an entity is being tracked by this system
696
- *
697
- * @param entity 要检查的实体 / The entity to check
698
- * @returns 是否正在跟踪 / Whether the entity is being tracked
699
- */
700
- isTracking(entity) {
701
- return this._entityCache.isTracked(entity);
702
- }
703
- /**
704
- * 当实体的组件发生变化时由 Scene 调用
705
- *
706
- * 立即检查实体是否匹配并触发 onAdded/onRemoved 回调。
707
- * 这是事件驱动设计的核心:组件变化时立即通知相关系统。
708
- *
709
- * Called by Scene when an entity's components change.
710
- * Immediately checks if the entity matches and triggers onAdded/onRemoved callbacks.
711
- * This is the core of event-driven design: notify relevant systems immediately when components change.
712
- *
713
- * @param entity 组件发生变化的实体 / The entity whose components changed
714
- * @internal 由 Scene.notifyEntityComponentChanged 调用 / Called by Scene.notifyEntityComponentChanged
715
- */
716
- handleEntityComponentChanged(entity) {
717
- if (!this._matcher || !this._enabled) {
718
- return;
719
- }
720
- const wasTracked = this._entityCache.isTracked(entity);
721
- const nowMatches = this.matchesEntity(entity);
722
- if (!wasTracked && nowMatches) {
723
- // 新匹配:添加跟踪并触发 onAdded | New match: add tracking and trigger onAdded
724
- this._entityCache.addTracked(entity);
725
- this._entityCache.invalidate();
726
- this.onAdded(entity);
727
- }
728
- else if (wasTracked && !nowMatches) {
729
- // 不再匹配:移除跟踪并触发 onRemoved | No longer matches: remove tracking and trigger onRemoved
730
- this._entityCache.removeTracked(entity);
731
- this._entityCache.invalidate();
732
- this.onRemoved(entity);
733
- }
734
- }
735
- /**
736
- * 更新实体跟踪,检查新增和移除的实体
737
- *
738
- * 由于采用了事件驱动设计,运行时的 onAdded/onRemoved 已在 handleEntityComponentChanged 中
739
- * 立即触发。此方法不再触发回调,只同步跟踪状态。
740
- *
741
- * With event-driven design, runtime onAdded/onRemoved are triggered immediately in
742
- * handleEntityComponentChanged. This method no longer triggers callbacks, only syncs tracking state.
743
- */
744
- updateEntityTracking(currentEntities) {
745
- const currentSet = new Set(currentEntities);
746
- let hasChanged = false;
747
- // 检查新增的实体 | Check for newly added entities
748
- for (const entity of currentEntities) {
749
- if (!this._entityCache.isTracked(entity)) {
750
- this._entityCache.addTracked(entity);
751
- hasChanged = true;
752
- }
753
- }
754
- // 检查移除的实体 | Check for removed entities
755
- for (const entity of this._entityCache.getTracked()) {
756
- if (!currentSet.has(entity)) {
757
- this._entityCache.removeTracked(entity);
758
- hasChanged = true;
759
- }
760
- }
761
- // 如果实体发生了变化,使缓存失效 | If entities changed, invalidate cache
762
- if (hasChanged) {
763
- this._entityCache.invalidate();
764
- }
765
- }
766
- /**
767
- * 当实体被添加到系统时调用
768
- *
769
- * 子类可以重写此方法来处理实体添加事件。
770
- *
771
- * @param entity 被添加的实体
772
- */
773
- onAdded(_entity) {
774
- // 子类可以重写此方法
775
- }
776
- /**
777
- * 当实体从系统中移除时调用
778
- *
779
- * 子类可以重写此方法来处理实体移除事件。
780
- *
781
- * @param entity 被移除的实体
782
- */
783
- onRemoved(_entity) {
784
- // 子类可以重写此方法
785
- }
786
- /**
787
- * 释放系统资源
788
- *
789
- * 实现IService接口要求的dispose方法。
790
- * 当系统从Scene中移除或Scene销毁时调用。
791
- *
792
- * 默认行为:
793
- * - 移除所有事件监听器
794
- * - 调用 onDestroy 回调(仅首次)
795
- * - 清空所有缓存
796
- * - 重置初始化状态
797
- *
798
- * 子类可以重写此方法来清理自定义资源,但应该调用super.dispose()。
799
- */
800
- dispose() {
801
- // 防止重复销毁
802
- if (this._destroyed) {
803
- return;
804
- }
805
- // 移除所有事件监听器
806
- this.cleanupManualEventListeners();
807
- // 调用用户销毁回调
808
- this.onDestroy();
809
- // 清空所有缓存
810
- this._entityCache.clearAll();
811
- this._entityIdMap = null;
812
- // 清理命令缓冲区
813
- // Clear command buffer
814
- this.commands.dispose();
815
- // 重置状态
816
- this._initialized = false;
817
- this._scene = null;
818
- this._destroyed = true;
819
- this.logger.debug(`System ${this._systemName} disposed`);
820
- }
821
- /**
822
- * 添加事件监听器
823
- *
824
- * 推荐使用此方法而不是直接调用eventSystem.on(),
825
- * 这样可以确保系统移除时自动清理监听器,避免内存泄漏。
826
- *
827
- * @param eventType 事件类型
828
- * @param handler 事件处理函数
829
- * @param config 监听器配置
830
- * @returns 监听器引用ID,可用于手动移除监听器
831
- */
832
- addEventListener(eventType, handler, config) {
833
- if (!this.scene?.eventSystem) {
834
- this.logger.warn(`${this.systemName}: 无法添加事件监听器,scene.eventSystem 不可用`);
835
- return null;
836
- }
837
- const listenerRef = this.scene.eventSystem.on(eventType, handler, config);
838
- // 跟踪监听器以便后续清理
839
- if (listenerRef) {
840
- this._eventListeners.push({
841
- eventSystem: this.scene.eventSystem,
842
- eventType,
843
- listenerRef
844
- });
845
- }
846
- return listenerRef;
847
- }
848
- /**
849
- * 移除特定的事件监听器
850
- *
851
- * @param eventType 事件类型
852
- * @param listenerRef 监听器引用ID(由 addEventListener 返回)
853
- */
854
- removeEventListener(eventType, listenerRef) {
855
- const listenerIndex = this._eventListeners.findIndex((listener) => listener.eventType === eventType && listener.listenerRef === listenerRef);
856
- if (listenerIndex >= 0) {
857
- const listener = this._eventListeners[listenerIndex];
858
- if (!listener)
859
- return;
860
- // 从事件系统中移除
861
- listener.eventSystem.off(eventType, listener.listenerRef);
862
- // 从跟踪列表中移除
863
- this._eventListeners.splice(listenerIndex, 1);
864
- }
865
- }
866
- /**
867
- * 清理手动添加的事件监听器
868
- */
869
- cleanupManualEventListeners() {
870
- for (const listener of this._eventListeners) {
871
- try {
872
- listener.eventSystem.off(listener.eventType, listener.listenerRef);
873
- }
874
- catch (error) {
875
- this.logger.warn(`${this.systemName}: 移除事件监听器失败 "${listener.eventType}"`, error);
876
- }
877
- }
878
- // 清空跟踪列表
879
- this._eventListeners.length = 0;
880
- }
881
- /**
882
- * 框架内部销毁方法
883
- * 由框架调用,处理系统的完整销毁流程
884
- */
885
- destroy() {
886
- // 防止重复销毁
887
- if (this._destroyed) {
888
- return;
889
- }
890
- this.cleanupManualEventListeners();
891
- this._destroyed = true;
892
- this.onDestroy();
893
- }
894
- /**
895
- * 获取Logger名称
896
- * 默认返回类的构造函数名称, 子类可以重写此方法来自定义logger名称
897
- */
898
- getLoggerName() {
899
- return getSystemInstanceTypeName(this);
900
- }
901
- /**
902
- * 用户销毁回调
903
- *
904
- * 当系统从场景中移除时调用,子类可以重写此方法进行清理操作。
905
- * 注意:事件监听器会被框架自动清理,无需手动处理。
906
- */
907
- onDestroy() {
908
- // 子类可以重写此方法进行清理操作
909
- }
910
- /**
911
- * 类型安全地获取单个组件
912
- *
913
- * 相比Entity.getComponent,此方法保证返回非空值,
914
- * 如果组件不存在会抛出错误而不是返回null
915
- *
916
- * @param entity 实体
917
- * @param componentType 组件类型
918
- * @returns 组件实例(保证非空)
919
- * @throws 如果组件不存在则抛出错误
920
- *
921
- * @example
922
- * ```typescript
923
- * protected process(entities: readonly Entity[]): void {
924
- * for (const entity of entities) {
925
- * const transform = this.requireComponent(entity, Transform);
926
- * // transform 保证非空,类型为 Transform
927
- * }
928
- * }
929
- * ```
930
- */
931
- requireComponent(entity, componentType) {
932
- const component = entity.getComponent(componentType);
933
- if (!component) {
934
- throw new Error(`Component ${componentType.name} not found on entity ${entity.name} in ${this.systemName}`);
935
- }
936
- return component;
937
- }
938
- /**
939
- * 批量获取实体的所有必需组件
940
- *
941
- * 根据泛型参数TComponents推断返回类型,
942
- * 返回一个元组,包含所有组件实例
943
- *
944
- * @param entity 实体
945
- * @param components 组件类型数组
946
- * @returns 组件实例元组
947
- *
948
- * @example
949
- * ```typescript
950
- * class MySystem extends EntitySystem<[typeof Position, typeof Velocity]> {
951
- * protected process(entities: readonly Entity[]): void {
952
- * for (const entity of entities) {
953
- * const [pos, vel] = this.getComponents(entity, Position, Velocity);
954
- * // pos: Position, vel: Velocity (自动类型推断)
955
- * pos.x += vel.x;
956
- * }
957
- * }
958
- * }
959
- * ```
960
- */
961
- getComponents(entity, ...components) {
962
- return components.map((type) => this.requireComponent(entity, type));
963
- }
964
- /**
965
- * 遍历实体并处理每个实体
966
- *
967
- * 提供更简洁的语法糖,避免手动遍历
968
- *
969
- * @param entities 实体列表
970
- * @param processor 处理函数
971
- *
972
- * @example
973
- * ```typescript
974
- * protected process(entities: readonly Entity[]): void {
975
- * this.forEach(entities, (entity) => {
976
- * const transform = this.requireComponent(entity, Transform);
977
- * transform.position.y -= 9.8 * Time.deltaTime;
978
- * });
979
- * }
980
- * ```
981
- */
982
- forEach(entities, processor) {
983
- for (let i = 0; i < entities.length; i++) {
984
- processor(entities[i], i);
985
- }
986
- }
987
- /**
988
- * 过滤实体
989
- *
990
- * @param entities 实体列表
991
- * @param predicate 过滤条件
992
- * @returns 过滤后的实体数组
993
- *
994
- * @example
995
- * ```typescript
996
- * protected process(entities: readonly Entity[]): void {
997
- * const activeEntities = this.filterEntities(entities, (entity) => {
998
- * const health = this.requireComponent(entity, Health);
999
- * return health.value > 0;
1000
- * });
1001
- * }
1002
- * ```
1003
- */
1004
- filterEntities(entities, predicate) {
1005
- return Array.from(entities).filter(predicate);
1006
- }
1007
- /**
1008
- * 映射实体到另一种类型
1009
- *
1010
- * @param entities 实体列表
1011
- * @param mapper 映射函数
1012
- * @returns 映射后的结果数组
1013
- *
1014
- * @example
1015
- * ```typescript
1016
- * protected process(entities: readonly Entity[]): void {
1017
- * const positions = this.mapEntities(entities, (entity) => {
1018
- * const transform = this.requireComponent(entity, Transform);
1019
- * return transform.position;
1020
- * });
1021
- * }
1022
- * ```
1023
- */
1024
- mapEntities(entities, mapper) {
1025
- return Array.from(entities).map(mapper);
1026
- }
1027
- /**
1028
- * 查找第一个满足条件的实体
1029
- *
1030
- * @param entities 实体列表
1031
- * @param predicate 查找条件
1032
- * @returns 第一个满足条件的实体,或undefined
1033
- *
1034
- * @example
1035
- * ```typescript
1036
- * protected process(entities: readonly Entity[]): void {
1037
- * const player = this.findEntity(entities, (entity) =>
1038
- * entity.hasComponent(PlayerTag)
1039
- * );
1040
- * }
1041
- * ```
1042
- */
1043
- findEntity(entities, predicate) {
1044
- for (let i = 0; i < entities.length; i++) {
1045
- if (predicate(entities[i], i)) {
1046
- return entities[i];
1047
- }
1048
- }
1049
- return undefined;
1050
- }
1051
- /**
1052
- * 检查是否存在满足条件的实体
1053
- *
1054
- * @param entities 实体列表
1055
- * @param predicate 检查条件
1056
- * @returns 是否存在满足条件的实体
1057
- *
1058
- * @example
1059
- * ```typescript
1060
- * protected process(entities: readonly Entity[]): void {
1061
- * const hasLowHealth = this.someEntity(entities, (entity) => {
1062
- * const health = this.requireComponent(entity, Health);
1063
- * return health.value < 20;
1064
- * });
1065
- * }
1066
- * ```
1067
- */
1068
- someEntity(entities, predicate) {
1069
- for (let i = 0; i < entities.length; i++) {
1070
- if (predicate(entities[i], i)) {
1071
- return true;
1072
- }
1073
- }
1074
- return false;
1075
- }
1076
- /**
1077
- * 检查是否所有实体都满足条件
1078
- *
1079
- * @param entities 实体列表
1080
- * @param predicate 检查条件
1081
- * @returns 是否所有实体都满足条件
1082
- *
1083
- * @example
1084
- * ```typescript
1085
- * protected process(entities: readonly Entity[]): void {
1086
- * const allHealthy = this.everyEntity(entities, (entity) => {
1087
- * const health = this.requireComponent(entity, Health);
1088
- * return health.value > 50;
1089
- * });
1090
- * }
1091
- * ```
1092
- */
1093
- everyEntity(entities, predicate) {
1094
- for (let i = 0; i < entities.length; i++) {
1095
- if (!predicate(entities[i], i)) {
1096
- return false;
1097
- }
1098
- }
1099
- return true;
1100
- }
1101
- }
1102
- //# sourceMappingURL=EntitySystem.js.map