* 更新系统
()
| 787 | * 更新系统 |
| 788 | */ |
| 789 | public update(): void { |
| 790 | // 检查是否应该处理,并缓存结果供 lateUpdate 使用 |
| 791 | // Check if should process and cache result for lateUpdate |
| 792 | this._shouldProcessThisFrame = this._enabled && this.onCheckProcessing(); |
| 793 | |
| 794 | if (!this._shouldProcessThisFrame) { |
| 795 | return; |
| 796 | } |
| 797 | |
| 798 | const monitor = this.getPerformanceMonitor(); |
| 799 | const startTime = monitor.startMonitoring(this._systemName); |
| 800 | let entityCount = 0; |
| 801 | |
| 802 | try { |
| 803 | this.onBegin(); |
| 804 | // 查询实体并存储到帧缓存中 |
| 805 | // ReactiveQuery.getEntities() 返回的是安全快照,只在实体变化时才创建新数组 |
| 806 | // ReactiveQuery.getEntities() returns a safe snapshot, only creates new array when entities change |
| 807 | const entities = this.queryEntities(); |
| 808 | this._entityCache.setFrame(entities); |
| 809 | entityCount = entities.length; |
| 810 | |
| 811 | this.process(entities); |
| 812 | } finally { |
| 813 | monitor.endMonitoring(this._systemName, startTime, entityCount); |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | /** |
| 818 | * 后期更新系统 |
nothing calls this directly
no test coverage detected