* 将系统添加到组件索引 * * 根据系统的 Matcher 条件,将系统注册到相应的组件ID索引中。 * * Index a system by its interested component types. * Registers the system to component ID indices based on its Matcher conditions. * * @param system 要索引的系统 | The system to index
(system: EntitySystem)
| 697 | * @param system 要索引的系统 | The system to index |
| 698 | */ |
| 699 | private indexSystemByComponents(system: EntitySystem): void { |
| 700 | const matcher = system.matcher; |
| 701 | if (!matcher) { |
| 702 | return; |
| 703 | } |
| 704 | |
| 705 | if (matcher.isNothing()) { |
| 706 | return; |
| 707 | } |
| 708 | |
| 709 | const condition = matcher.getCondition(); |
| 710 | |
| 711 | if (condition.none.length > 0 || condition.tag !== undefined || condition.name !== undefined) { |
| 712 | this._globalNotifySystems.add(system); |
| 713 | } |
| 714 | |
| 715 | if (matcher.isEmpty()) { |
| 716 | this._globalNotifySystems.add(system); |
| 717 | return; |
| 718 | } |
| 719 | |
| 720 | for (const componentType of condition.all) { |
| 721 | this.addSystemToComponentIndex(componentType, system); |
| 722 | } |
| 723 | |
| 724 | for (const componentType of condition.any) { |
| 725 | this.addSystemToComponentIndex(componentType, system); |
| 726 | } |
| 727 | |
| 728 | if (condition.component) { |
| 729 | this.addSystemToComponentIndex(condition.component, system); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | /** |
| 734 | * 将系统添加到指定组件的索引 |
no test coverage detected