MCPcopy Create free account
hub / github.com/esengine/esengine / update

Function update

packages/core/src/ECS/Systems/EntitySystem.ts:789–815  ·  view source on GitHub ↗

* 更新系统

()

Source from the content-addressed store, hash-verified

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 * 后期更新系统

Callers

nothing calls this directly

Calls 7

processMethod · 0.65
onCheckProcessingMethod · 0.45
startMonitoringMethod · 0.45
onBeginMethod · 0.45
queryEntitiesMethod · 0.45
setFrameMethod · 0.45
endMonitoringMethod · 0.45

Tested by

no test coverage detected