// Does the passed in EntityType fit this grouping? public bool InGroup(EntityType entityType, bool useCache = true) { // If cache exists use it if (useCache && entityTypeMatches != null) { return(entityTypeMatches.Contains(entityType)); } // If a specific include/exclude EntityTypes are selected check them first if (includeEntityTypes != null && includeEntityTypes.Count > 0) { if (includeEntityTypes.Contains(entityType)) { return(true); } } if (excludeEntityTypes != null && excludeEntityTypes.Count > 0) { if (excludeEntityTypes.Contains(entityType)) { return(false); } } // If there are included EntityTypes and no TypeCategories then only allow ones in the include if (includeEntityTypes != null && includeEntityTypes.Count > 0 && (typeCategories == null || typeCategories.Count == 0)) { return(false); } // TypeCategory match and reject any ones that fail match if (!CategoriesMatch(entityType.typeCategories)) { return(false); } // Finaly do general Type level checks switch (entityTypeEnum) { case EntityTypeEnum.EntityType: if (entityType is EntityType) { return(true); } break; case EntityTypeEnum.AgentType: if (entityType is AgentType) { return(true); } break; case EntityTypeEnum.WorldObjectType: if (entityType is WorldObjectType) { return(true); } break; case EntityTypeEnum.AgentEventType: if (entityType is AgentEventType) { return(true); } break; } return(false); }