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

Method _applySystemConfig

packages/runtime-core/src/GameRuntime.ts:327–351  ·  view source on GitHub ↗

* @zh 应用系统配置 * @en Apply system configuration

(config: RuntimeModeConfig)

Source from the content-addressed store, hash-verified

325 * @en Apply system configuration
326 */
327 private _applySystemConfig(config: RuntimeModeConfig): void {
328 const services = this._systemContext?.services;
329 if (!services) return;
330
331 // 物理系统
332 const physicsSystem = services.get(Physics2DSystemToken);
333 if (physicsSystem) {
334 physicsSystem.enabled = config.enablePhysics;
335 }
336
337 // 行为树系统
338 const behaviorTreeSystem = services.get(BehaviorTreeSystemToken);
339 if (behaviorTreeSystem) {
340 behaviorTreeSystem.enabled = config.enableBehaviorTree;
341 if (config.enableBehaviorTree) {
342 behaviorTreeSystem.startAllAutoStartTrees?.();
343 }
344 }
345
346 // 动画系统
347 const animatorSystem = services.get(SpriteAnimatorSystemToken);
348 if (animatorSystem) {
349 animatorSystem.enabled = config.enableAnimation;
350 }
351 }
352
353 /**
354 * 初始化运行时

Callers 2

setModeMethod · 0.95
initializeMethod · 0.95

Calls 2

getMethod · 0.65

Tested by

no test coverage detected