public void RemoveComponent(IEntity entity, Type componenType) { ReactorConnection connection; if (!_connections.TryGetValue(componenType, out connection)) { var set = new HashSet <Type>(TargetTypes); SystemReactor reactor = _systemExecutor.GetSystemReactor(set); connection = new ReactorConnection(this, reactor); this.AddReactorsConnection(componenType, connection, reactor); } entity.Reactor = connection.DownReactor; _systemExecutor.RemoveSystemsFromEntity(entity, connection); }
public void RemoveComponent(IEntity entity, IComponent component) { var typeId = component.TypeId; if (!_inConnectionIndex.TryGetValue(typeId, out var connection)) { var typeList = new List <Type>(TargetTypesSet); typeList.Remove(component.Type); SystemReactor prevReactor = _systemExecutor.GetOrCreateConcreteSystemReactor(typeList); connection = new ReactorConnection(component.Type, this, prevReactor); _inConnectionIndex.Add(component, connection); prevReactor._outConnectionIndex.Add(component, connection); } _systemExecutor.RemoveSystemsFromEntity(entity, connection); entity.Reactor = connection.DownReactor; }