2 using System.Collections.Generic;
6 public partial class Matcher<TEntity> {
10 matcher._allOfIndices = distinctIndices(indices);
16 setComponentNames(allOfMatcher, matchers);
22 matcher._anyOfIndices = distinctIndices(indices);
28 setComponentNames(anyOfMatcher, matchers);
32 static int[] mergeIndices(
int[] allOfIndices,
int[] anyOfIndices,
int[] noneOfIndices) {
35 if(allOfIndices != null) {
36 indicesList.AddRange(allOfIndices);
38 if(anyOfIndices != null) {
39 indicesList.AddRange(anyOfIndices);
41 if(noneOfIndices != null) {
42 indicesList.AddRange(noneOfIndices);
45 var mergedIndices = distinctIndices(indicesList);
53 var indices =
new int[matchers.Length];
54 for (
int i = 0; i < matchers.Length; i++) {
55 var matcher = matchers[i];
56 if(matcher.indices.Length != 1) {
59 indices[i] = matcher.indices[0];
66 for (
int i = 0; i < matchers.Length; i++) {
68 if(matcher != null && matcher.componentNames != null) {
69 return matcher.componentNames;
77 var componentNames = getComponentNames(matchers);
78 if(componentNames != null) {
79 matcher.componentNames = componentNames;
83 static int[] distinctIndices(IList<int> indices) {
86 foreach(var index
in indices) {
87 indicesSet.Add(index);
89 var uniqueIndices =
new int[indicesSet.Count];
90 indicesSet.CopyTo(uniqueIndices);
91 Array.Sort(uniqueIndices);