private static EntitySetBuilder Simple(EntitySetBuilder builder, Type[] componentTypes, MethodInfo method) { foreach (Type componentType in componentTypes) { method.MakeGenericMethod(componentType).Invoke(builder, null); } return(builder); }
private static EntitySetBuilder Either(EntitySetBuilder builder, Type[] componentTypes, MethodInfo method) { EntitySetBuilder.EitherBuilder eitherBuilder = null; foreach (Type componentType in componentTypes) { if (eitherBuilder is null) { eitherBuilder = (EntitySetBuilder.EitherBuilder)method.MakeGenericMethod(componentType).Invoke(builder, null); } else { _or.MakeGenericMethod(componentType).Invoke(eitherBuilder, null); } } if (eitherBuilder != null) { _commit.Invoke(eitherBuilder, null); } return(builder); }
internal EitherBuilder(EntitySetBuilder builder, EitherType type) { _builder = builder; _type = type; }
/// <summary> /// Makes a rule to ignore <see cref="Entity"/> with at least one component of the given types. /// </summary> /// <param name="builder">The <see cref="EntitySetBuilder"/> on which to create the rule.</param> /// <param name="componentTypes">The types of component.</param> /// <returns>The current <see cref="EntitySetBuilder"/>.</returns> public static EntitySetBuilder Without(this EntitySetBuilder builder, params Type[] componentTypes) => Simple(builder, componentTypes, _without);
/// <summary> /// Makes a rule to observe <see cref="Entity"/> when one component of the given types is removed. /// </summary> /// <param name="builder">The <see cref="EntitySetBuilder"/> on which to create the rule.</param> /// <param name="componentTypes">The types of component.</param> /// <returns>The current <see cref="EntitySetBuilder"/>.</returns> public static EntitySetBuilder WhenRemovedEither(this EntitySetBuilder builder, params Type[] componentTypes) => Either(builder, componentTypes, _whenRemovedEither);
/// <summary> /// Makes a rule to obsverve <see cref="Entity"/> without at least one component of the given types. /// </summary> /// <param name="builder">The <see cref="EntitySetBuilder"/> on which to create the rule.</param> /// <param name="componentTypes">The types of component.</param> /// <returns>The current <see cref="EntitySetBuilder"/>.</returns> public static EntitySetBuilder WithoutEither(this EntitySetBuilder builder, params Type[] componentTypes) => Either(builder, componentTypes, _withoutEither);
/// <summary> /// Makes a rule to obsverve <see cref="Entity"/> when all component of the given types are removed. /// </summary> /// <param name="builder">The <see cref="EntitySetBuilder"/> on which to create the rule.</param> /// <param name="componentTypes">The types of component.</param> /// <returns>The current <see cref="EntitySetBuilder"/>.</returns> public static EntitySetBuilder WhenRemoved(this EntitySetBuilder builder, params Type[] componentTypes) => Simple(builder, componentTypes, _whenRemoved);