public Node GetNode(ComponentMatcher componentMatcher) { if (!nodes.TryGetValue(componentMatcher, out Node node)) { node = new Node(componentMatcher); var entities = GetAllEntities(); for (int i = 0; i < entities.Length; i++) { node.HandleEntity(entities[i]); } nodes.Add(componentMatcher, node); var matcherIndices = componentMatcher.GetIndices(); for (int i = 0; i < matcherIndices.Length; i++) { var componentID = matcherIndices[i]; if (nodesForComponentId[componentID] == null) { var nodeList = new List <Node>(); nodesForComponentId[componentID] = nodeList; } nodesForComponentId[componentID].Add(node); } } return(node); }
public Node(ComponentMatcher matcher) { this.matcher = matcher; }