public override int GetHashCode() { int hash = 13; hash = (hash * 7) + AllSet.GetHashCode(); hash = (hash * 7) + OneSet.GetHashCode(); hash = (hash * 7) + ExclusionSet.GetHashCode(); return(hash); }
public bool Match(IEntity entity) { Func <Type, bool> hasComponent = (t => entity.HasComponent(t)); if (ExclusionSet.Any(hasComponent)) { return(false); } if (!AllSet.All(hasComponent)) { return(false); } if (OneSet.Any() && !OneSet.Any(hasComponent)) { return(false); } // Nobody complained so we're good here! return(true); }