* @zh 应用系统配置 * @en Apply system configuration
(config: RuntimeModeConfig)
| 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 | * 初始化运行时 |
no test coverage detected